Rain at random times

As the title says, I want to make my game rain periodically.
How would I do this? I have been looking for this for a long time now.

3 Likes

You can try using a plugin someone made:

Hello there @NormalBaconHair13, to achieve something like this have you looked into loops? randomised math numbers? these can give the affect of random timing.

For the rain, this should be achieved by particle effects. Like @Meta_data has said, there is already rain modules that you can insert ingame to remove any hassle.

I use that for the rain, but I don’t understand how to make it rain periodically. Would I have to use
a loop?

Yes, if its a plugin where you have to fire a function, a loop would be optional for turning on and off the rain.

You can make a while true loop with a wait that can be randomised at different speeds.

Sift through the module, it has a lot of documented functions.

I’ve personally never used it, but I just skimmed through it and I think something like this could work:

local rain = require(script.Rain)

rain:Enable()

wait(5)

rain:Disable()

EDIT: I’ve tested this, and yes it works in a LocalScript.

Yes this does work, but is not efficient and realistic

Your better of doing something like this:

local module = require(script.Rain)

while true do
wait(math.random(5, 50))
module:Enable()
wait(math.random(5, 50))
module:Disable()
end

This makes the rain stop and start at randomised time, making the rain therefore more realistic.

3 Likes

Where would I place this local script?

You would place the local script into a compatiable local side folder such as in:

Game > StarterGui > Gui

OR

Game > StarterPlayer > StarterCharacterScripts/StarterPlayerScripts

and I’m pretty sure it may be able to be placed in Workspace aswell.

1 Like

How would I want to make it rain longer?

1 Like