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.
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.