orders = {"I wanna have a bloxycola plz","I wanna have doritos","I wanna have a bowling shoes plz"} while true do if script.Parent.YesNo.Value == false then script.Parent.YesNo.Value = true human = game.Lighting.People:GetChildren() humanclone = math.random(1, #human) humanclone = human[humanclone] h = math.random(1, #orders) humanclone.Say.Value = orders[h] clonehuman = humanclone:Clone() clonehuman.Parent = game.Workspace clonehuman:MoveTo(script.Parent.Position) wait(5) end end
I am having a problem with it, It should do loop but when it start it should stop generating characters but the problem is when I active it, it start to crash and spawn the character but no more code was loaded can somebody look at it? note it says warning in line 2 but I dont notice the error
Place the wait() directly inside the while loop. Currently the script only waits while script.Parent.YesNo.Value
is false; while the value is true, it is trying to go through the loop infinite times per second.
while true do if value == false then wait() end end
should be:
while true do if value == false then end wait() end