Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

[Found the real answer myself] Why does wait(math.huge) not wait forever?

The reason why wait(math.huge) can't be used in Roblox anymore, is because previously when players put wait(math.huge) in a script, it would break all the wait's in the game.

2 comments

0

Why would you want to do that? You're basically disabling the script that way.

0

I know it's useless, but I just wanted to use it as a joke for things with wait limitations. Such as ===game.OnClose = function() wait(math.huge) end====

1 answer

✓ Accepted answer

Math.huge is infinity, so if you want a script to stop running you should either disable or end the script there. You could also have an infinite loop and break when it is time to run the script again.


#Final Product

--Use an infinite loop to stop the script. Or Disable it.
script.Disable = true
--or
while wait() do end


Hope it helps!


#Additional things You can only wait for a max of 30 seconds when using OnClose. So wait(math.huge) won't work.

1 comment

0

I don't think anyone understood my actual question but thanks for addressing it as you read it. I'm just commenting on your answer to point out that if onclose is set to wait for lets say 1000000 seconds, it will wait for 30 seconds and then close.

This discussion is preserved as it was. New answers, comments, and votes are closed.