Say you were using a random generator to generate a number and you have a loop going until this number is greater than 5 and then it will stop the script. I want to know how to restart the script so that it starts over again and then generates a random number still. Preferably how to restart with a mouse click.
COMMUNITY QUESTION
How do I Reboot a script once it has stopped?
1 answer
There are many answers to that... Most likely thing you would use are functions/events
local CD = script.Parent -- Clickdetector
t = 0
CD.MouseClick:connect(function(click)
repeat
number = math.random(1,10)
until number > 5
end)
You can also do this (used less) with cloning. (Storing the script in serverstorage and clone it when you need it) This is better for larger scripts.
This discussion is preserved as it was. New answers, comments, and votes are closed.
