so iv been trying to make my first game the idea is you get Teleported to a map you get a sword and the last person to die wins and gets points iv been trying to fix this problem for days but them i tried to run a code under a while loop and it didn't work? so then i made a short script to test if anything under will run and it didn't Any Help? Here's the simple script:
while wait() do print("In side loop print") wait(10) end print("Outside loop print")
As you see it doesn't print OutSide loop print Any Help?
fix
local Time = 0 local Delay = 10 spawn(function() while wait(Time) do print("In") wait(Delay) end end) print("Out")
You have to figure out if you want your loop to run forever, or if you want it to run until some condition is met. One common method is to use a "flag" to tell the loop to continue running:
local keepGoing = true -- Flag while (keepGoing) do -- Stuff if (stuffDone) do keepGoing = false end end print("Loop over!")