Oops. Make that the following instead (a slight addition I spotted was needed). The annotations are for when my friend needs to edit this (if he pleases).
--Hostiles
Drone = game.Lighting:FindFirstChild("Drone")
Drone2 = game.Lighting:FindFirstChild("Drone")
Drone3 = game.Lighting:FindFirstChild("Drone")
Drone4 = game.Lighting:FindFirstChild("Drone")
Sniper = game.Lighting:FindFirstChild("Sniper")
Sniper2 = game.Lighting:FindFirstChild("Sniper")
Sniper3 = game.Lighting:FindFirstChild("Sniper")
Sniper4 = game.Lighting:FindFirstChild("Sniper")
Worker = game.Lighting:FindFirstChild("Worker")
Worker2 = game.Lighting:FindFirstChild("Worker")
Worker3 = game.Lighting:FindFirstChild("Worker")
Worker4 = game.Lighting:FindFirstChild("Worker")
Defender = game.Lighting:FindFirstChild("Defender")
Defender2 = game.Lighting:FindFirstChild("Defender")
Defender3 = game.Lighting:FindFirstChild("Defender")
Defender4 = game.Lighting:FindFirstChild("Defender")
MasterDrone = game.Lighting:FindFirstChild("MasterDrone")
MasterDrone2 = game.Lighting:FindFirstChild("MasterDrone")
MasterDrone3 = game.Lighting:FindFirstChild("MasterDrone")
MasterDrone4 = game.Lighting:FindFirstChild("MasterDrone")
OverDrone = game.Lighting:FindFirstChild("OverDrone")
OverDrone2 = game.Lighting:FindFirstChild("OverDrone")
OverDrone3 = game.Lighting:FindFirstChild("OverDrone")
OverDrone4 = game.Lighting:FindFirstChild("OverDrone")
--SpawnValues
Spawn1Value = game.Workspace:FindFirstChild("Part1SpawnAI")
--SpawnLocations
Spawn1ValueA = Vector3.new(-513.5, 194.5, -786.5)
Spawn1ValueB = Vector3.new(-589.5, 194.5, -861.5)
Spawn1ValueC = Vector3.new(-538, 197, -820.5)
Spawn1ValueD = Vector3.new(-533, 197, -812.5)
Spawn1ValueE = Vector3.new(-547, 221, -787.5)
Spawn1ValueF = Vector3.new(-588.5, 221, -793)
--Number of AI
Part1DroneNumber = 4
Part1SniperNumber = 2
--Other
DetectAIScript = game.Lighting.CheckRemove
function SpawnAI()
if Spawn1Value.Value == true and Spawn1Value.IsPresent.Value == false then --For a new Spawn area, copy from here
Spawn1Value.Value = false
Spawn1Value.IsPresent.Value = true
Model = Instance.new("Model")
Model.Name = ("AISpawn1")
Model.Parent = game.Workspace
DeadValue = Instance.new("IntValue")
DeadValue.Parent = Model
DeadValue.Name = "DeadMaxValue"
DeadValue.Value = Part1DroneNumber + Part1SniperNumber
DeadValue2 = Instance.new("IntValue")
DeadValue2.Parent = Model
DeadValue2.Name = "DeadValue"
DeadValue2.Value = 0
NameValue = Instance.new("StringValue")
NameValue.Parent = Model
NameValue.Name = "NameValue"
NameValue.Value = Spawn1Value.Name
DetectAIScript:Clone().Parent = Model
Drone:Clone().Parent = Model --Change "Drone" etc after copying section if required
Drone:MakeJoints()
wait(0.5)
Drone:MoveTo(Spawn1ValueA)
Drone2:Clone().Parent = Model
Drone2:MakeJoints()
wait(0.5)
Drone2:MoveTo(Spawn1ValueB)
Drone3:Clone().Parent = Model
Drone3:MakeJoints()
wait(0.5)
Drone3:MoveTo(Spawn1ValueC)
Drone4:Clone().Parent = Model
Drone4:MakeJoints()
wait(0.5)
Drone4:MoveTo(Spawn1ValueD)
Sniper:Clone().Parent = Model
Sniper:MakeJoints()
wait(0.5)
Sniper:MoveTo(Spawn1ValueE)
Sniper2:Clone().Parent = Model
Sniper2:MakeJoints()
wait(0.5)
Sniper2:MoveTo(Spawn1ValueF)
end --To here, also change values at the top. This whole section does all the spawning for the first section/area of the game
end
Spawn1Value.Changed:connect(SpawnAI) |