I am trying to make sausages rain from the sky, but I have this button and from here I would like it to cost 20 robux each time and rain for 30 seconds, I have the developer product ready.
I have scripted the rain but it never ends at the moment, and I would like it to only work on purchase from a part called “button”
Your script starts with wait(10) which means when run it will wait 10 seconds, then it will continuously every .1 second cause a ‘RainPart’ to randomly appear.
You need a ClickDetector to get the player input inside that loop then run for 10 seconds.
Take the scripts they gave in the link and put your info into them.
I used it pretty much line for line except for the very core of the program that tells my game what to do. In my case it’s a purchase button to teleport a player past an obby level.
with a clickdetector, when a player clicks the button it can send an event that will have the sausages rain. Also I would use a for loop in this case, not a while loop to have the sausages rain for 10 seconds. In this case since you wait 0.1 seconds each time, you need to repeat the loop 100 times for 10 seconds.
Part.ClickDetector.MouseClick:Connect(function()
for i = 1, 100, 1 do
-- have the sausages rain
end
end)