Hello, fellow devs
I am new to scripting and have learned some things, but I can’t figure out how to loop a function forever.
I’d rather not spam 1 billion function triggers like this:
Is there a way I can just loop it so it keeps going without doing that?
Yes, but if you want to have a condition like a if statement
local Number = 12
while Number == 12 do -- loops until Number isnt equal to twelve
wait() -- this so your game doesnt crash
end
If you want the code to run forever, you use while true do, to break a loop, you use break or continue, the code below the loop wont run as the Loop is running, the only way to have it run the code is have it run in the background or break it
I got it to work after some experimentation thanks so much though. I can post a shot of the script if you want me to I made a flashing block I am planning on making a cool sign.
@DasKairo Thanks both I tried it before I saw this and it was working but I am adding it now. Before I already had a wait command at the end of the function but I put it in the While true part just now thanks!