im having a lot of trouble with this statement. I basically want it so when the wave reaches "2" a boss will spawn in. i have this coded so far
while wait do if game.ReplicatedStorage.Values.Wave.Value == 2 then game.ReplicatedStorage.BOSS.Zombie:Clone().Parent = game.Workspace else print("not in game") wait(2) end end
but when the wave reaches round 2, it spawns in a bunch of the objects until the game crashes. im pretty new to scripting so how would i go about making it so it only spawns in 1 object every time the wave = 2?
Make another if statement for if the boss is already spawned in. It'll check the statement, if it's false it spawns in a Boss Zombie, then sets it to true so no more can be spawned.
local BossSpawned = false if BossSpawned == false then {put whatever you want here} BossSpawned = true
First make a variable for game.ReplicatedStorage.Values.Wave.Value
Like this local wave2 = game.ReplicatedStorage.Values.Wave.Value
And for the boss too. Then do ```if wave2 == 2 then```` So now you need to clone it and after :Clone() you need to set who is the parent, where you want to clone it(boss.Position = Vector3.new(?,?,?)), and you will be done.