I’m trying to make a weather system using BuildThomas’s rain module, and I’m having some issues.
I don’t think my code is running altogether, and I’m not getting any errors.
LocalScript: (In ServerScriptService)
local event = game.ReplicatedStorage:WaitForChild("RainEvent")
while true do
local randomnumber = math.random(1,3) -- I changed it so that it should have run every time
if randomnumber == 1 then
local num = randomnumber
event:FireServer(num)
print("fired")
elseif randomnumber == 2 then
local num = randomnumber
event:FireServer(num)
print("fired")
elseif randomnumber == 3 then
local num = randomnumber
event:FireServer(num)
print("fired")
end
wait(40)
end
BindableEvent is in ReplicatedStorage.
Script in ServerScriptService:
local event = game.ReplicatedStorage:WaitForChild("RainEvent")
rainmod = require(script.Parent.Rain)
rainmod:Disable()
event.OnServerEvent:Connect(function(num)
print(num)
if num == 1 then
rainmod:SetTransparency(0)
rainmod:SetSpeedRatio(1)
rainmod:SetIntensityRatio(1)
rainmod:Enable()
wait(60)
rainmod:Disable()
elseif num == 2 then
rainmod:SetTransparency(0.4)
rainmod:SetSpeedRatio(0.6)
rainmod:SetIntensityRatio(0.6)
rainmod:Enable()
wait(40)
rainmod:Disable()
elseif num == 3 then
rainmod:SetTransparency(0.6)
rainmod:SetSpeedRatio(1)
rainmod:SetIntensityRatio(0.3)
rainmod:Enable()
wait(30)
rainmod:Disable()
end
wait(40)
end)
rainmod = require(script.Parent.Rain)
rainmod:Disable()
while wait() do
local num = math.random(1,3)
print(num)
if num == 1 then
rainmod:SetTransparency(0)
rainmod:SetSpeedRatio(1)
rainmod:SetIntensityRatio(1)
rainmod:Enable()
wait(60)
rainmod:Disable()
elseif num == 2 then
rainmod:SetTransparency(0.4)
rainmod:SetSpeedRatio(0.6)
rainmod:SetIntensityRatio(0.6)
rainmod:Enable()
wait(40)
rainmod:Disable()
elseif num == 3 then
rainmod:SetTransparency(0.6)
rainmod:SetSpeedRatio(1)
rainmod:SetIntensityRatio(0.3)
rainmod:Enable()
wait(30)
rainmod:Disable()
end
end
It’s probably because there’s soemthing in the rain script that can only be ran in a local script because it has RenderStepped in it. Try it in a local script