Developer product to make sausages rain

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”

Pictures of what I have so far



image
image

If you need anymore details please ask.

2 Likes

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.

Check this out:

3 Likes

This sounds like a good solution however, I have no clue what to do in this scenario, where do I put things and what do I change?

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.

1 Like

Do I take all the scripts from the link?

And how do I make them relate to the button?

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)

Here is a for loop article for more info on how they work: Introduction to Scripting | Documentation - Roblox Creator Hub

1 Like

Do I add a click detector into the button and then a script in that click detector with this script in it and the developer product number goes where.

1.) yes the click detector goes into the button

2.) the script can be parented anywhere in the model, as long as it can define everything

3.) the developer product number goes in a separate function where the player can buy the dev product from there

Do you use a boolvalue to determine if the player has the ability to rain sausages?

1 Like

I do not script myself so I do not have much knowledge but, it will start raining when anyone buys the product.

1 Like