Put the module anywhere you want I believe, I recommend putting it in ReplicatedStorage and changing that line to
rainmod = require(game.ReplicatedStorage.Rain)
Put the module anywhere you want I believe, I recommend putting it in ReplicatedStorage and changing that line to
rainmod = require(game.ReplicatedStorage.Rain)
It works now, but would the rain only run for the local player? I want it to run for the whole server, if that’s possible.
It would run for each player if done like this, meaning every player is going to see the rain since they each have the rain script
If I set the math.random
to something else, would each player get a different number?
Yea that’s the only thing that’s a problem, each will see different rain basically, you’d have to find a way to make it the same for everyone
Do you know a way I could possibly accomplish that?
You could put an intvalue in replicated storage. Have a server script change the int value and have the local scripts reference that value.
The issue with that is that all 3 of those statements have different waits, so he’d probably have to make it wait the longest it would be before rain changes, maybe every 65 seconds the value changes to be safe
Would setting all the waits to the same thing make it work better? (The waits differences aren’t neccessary)
If you want, if you made all of them 60 for example, you could make the wait in the server change the value randomly every 60.1 seconds to make sure it’s randomized before the clients can reference it
Like this?
while wait() do
local num = math.random(0,12)
script.Parent.Value = num
wait(60.1)
end
(sorry about formatting)
while true do
local num = math.random(0,12)
script.Parent.Value = num
wait(60.1)
end
I recommend putting the BaseValue itself i nReplicatedStorage, where you put the rain module too, and make the local scripts get that value from ReplicatedStorage and use that
The script would still be in the value, correct?
Put the value with the randomized number in ReplicatedStorage, and change that code to reference it and the localscripts to reference it as well
I put a print statement in the script (in the value), but it doesn’t run at all?
while wait() do
local num = math.random(0,12)
print(num)
script.Parent.Value = num
wait(60.1)
end
rainmod = require(game.ReplicatedStorage.Rain)
rainmod:Disable()
while wait() do
local num = game.ReplicatedStorage.Values.RainValue
if num == 0 then
rainmod:SetTransparency(0)
rainmod:SetSpeedRatio(1)
rainmod:SetIntensityRatio(1)
rainmod:Enable()
wait(60)
rainmod:Disable()
elseif num == 6 then
rainmod:SetTransparency(0.8)
rainmod:SetSpeedRatio(0.4)
rainmod:SetIntensityRatio(0.4)
rainmod:Enable()
wait(60)
rainmod:Disable()
elseif num == 12 then
rainmod:SetTransparency(0.8)
rainmod:SetSpeedRatio(1)
rainmod:SetIntensityRatio(0.1)
rainmod:Enable()
wait(60)
rainmod:Disable()
end
end
Your issue is that if it’s not 0, 6, or 12, it wont rain. So the rain wont happen. Also, change script.Parent.Value
to the location of the value itself, so
game.ReplicatedStorage.Values.RainValue.Value = num
Wouldn’t the print statement still run, and print the number? It’s not printing at the moment.
Ohh, where did you put that script? also again, while true do
, not while wait() do
in this case,
The script is inside the value, should I change it?
Put it in ServerScriptService and do the changes I mentioned