I recently began building a weather system from scratch. It operates by using server sided script as its foundational code which uses math.random() to determine whether it should rain or not with FireAllClients() which sends a signal to the local script to enable the raining effect for all players on the server. The server script still functions and I recieved no issues when I ran it in Studio, however when I played the test with two players, neither of them was able to see the rain effect. I will provide you with further scripts.
Server script:
local Rain = coroutine.wrap(function()
local Every = 1
local Raining = false
local Cooldown = false
while wait(Every) do
local Chance = math.random(1,1)
if Chance == 1 and Raining == false and Cooldown == false then
Raining = true
local Duration = math.random(180, 360)
warn("Raining")
game.Workspace.Weather.Raining.Value = true
game.ReplicatedStorage.Remotes.Weather.Rain:FireAllClients("Start Raining")
spawn(function() -- Duration
wait(Duration)
Cooldown = true
Raining = false
spawn(function()
wait(300)
Cooldown = false
end)
game.ReplicatedStorage.Remotes.Weather.Rain:FireAllClients("Stop Raining")
game.Workspace.Weather.Raining.Value = false
warn("Rain End")
end)
end
end
end)
Rain()
Local Script:
task.wait(2)
local Rain = require(script.Rain)
Rain:SetColor(Color3.fromRGB(script.Color.Value.x, script.Color.Value.y, script.Color.Value.z))
Rain:SetDirection(script.Direction.Value)
Rain:SetTransparency(script.Transparency.Value)
Rain:SetSpeedRatio(script.SpeedRatio.Value)
Rain:SetIntensityRatio(script.IntensityRatio.Value)
Rain:SetLightInfluence(script.LightInfluence.Value)
Rain:SetLightEmission(script.LightEmission.Value)
Rain:SetVolume(script.Volume.Value)
Rain:SetSoundId(script.SoundId.Value)
Rain:SetStraightTexture(script.StraightTexture.Value)
Rain:SetTopDownTexture(script.TopDownTexture.Value)
Rain:SetSplashTexture(script.SplashTexture.Value)
local threshold = script.TransparencyThreshold.Value
if script.TransparencyConstraint.Value and script.CanCollideConstraint.Value then
Rain:SetCollisionMode(
Rain.CollisionMode.Function,
function(p)
return p.Transparency <= threshold and p.CanCollide
end
)
elseif script.TransparencyConstraint.Value then
Rain:SetCollisionMode(
Rain.CollisionMode.Function,
function(p)
return p.Transparency <= threshold
end
)
elseif script.CanCollideConstraint.Value then
Rain:SetCollisionMode(
Rain.CollisionMode.Function,
function(p)
return p.CanCollide
end
)
end
game.ReplicatedStorage.Remotes.Weather.Rain.OnClientEvent:Connect(function(Action)
if Action == "Start Raining" then
warn("RAIN STARTED")
Rain:Enable()
elseif Action == "Stop Raining" then
Rain:Disable()
end
end)
and there’s the Module script which simulates the rain effect. I will provide you with it if needed.