I have a script, it works fine the first wave, but when you get to the second wave, it spawns in groups of five on top of each other and lags the game like crazy! Here is the script
repeat
wait(1)
if script.WaveHas.Value == 0 then
if script.Parent.WaveCount.Value == 2 then
script.WaveHas.Value = 1
local AmountOfWaves = 15 -- How many waves do you want? Put them here
local TimePerWave = 5 -- How long you want to wait per wave
local function SpawnWave()
local Bot = game.ReplicatedStorage.Alien:Clone()
Bot.Parent = workspace
Bot:MoveTo(Vector3.new(math.random(-254,254), 5, math.random(44,255)))
end
for CurrentWave = 1, AmountOfWaves do
SpawnWave()
wait(TimePerWave)
end
script.Parent.TimeLeft.Value = 120
wait(120)
script.Parent.WaveCount.Value = 3
print("set to wave 3")
end
end
until script.Parent.WaveCount.Value > 2
Please help!!! Thank you!!! PS. each wave is in a different script, but are all the same (other than variables such as WaveCount)

1 comment
Nope, didn't work, thanks though