Server Side Weather Script

Is anyone familiar with Narrakin’s weather script for the rain plugin?

here is a video for the tutorial https://www.youtube.com/watch?v=gYVAOcWQgYw&t=59s

But anyways, the script works fine, but its local. This causes everyone to see rain at different times because the rain script is in starterplayer scripts. I tried adding in a part that checks for server time to activate it, but it still only activated the rain for one player. Does anyone know how to make this work globally so everyone can see the rain at the same time? Here is the local script. I tried putting it in serverscriptservice, but couldnt get that to work either.


wait()
print("Disable Rate")
script.Parent.Parent.Parent.Parent.Workspace.Camera.__RainEmitter.RainStraight.Rate = 0
script.Parent.Parent.Parent.Parent.Workspace.Camera.__RainEmitter.RainTopDown.Rate = 0
print("Disable Sound")
script.Parent.Parent.Parent.Parent.SoundService.__RainSoundGroup.Volume = 0
print("Disable RainScript")
script.Parent.RainScript.Disabled = true

function RainCycle()


	--activating rain
	wait(10) --Change this to how long you want it to take before it can start raining again (this is after the script has started by the random start at the bottom)
	--activate rain lighting
	script.Parent.Parent.Parent.Parent.Lighting.Ambient = Color3.fromRGB(255, 255, 255)
	script.Parent.Parent.Parent.Parent.Lighting.Brightness = 3.43
	script.Parent.Parent.Parent.Parent.Lighting.ColorShift_Top = Color3.fromRGB(94,94,94)
	script.Parent.Parent.Parent.Parent.Lighting.EnvironmentDiffuseScale = 0.443
	script.Parent.Parent.Parent.Parent.Lighting.EnvironmentSpecularScale = 0.629
	script.Parent.Parent.Parent.Parent.Lighting.ExposureCompensation = -0.39

	script.Parent.Parent.Parent.Parent.Lighting.Bloom.Intensity = 0.3
	script.Parent.Parent.Parent.Parent.Lighting.Bloom.Size = 9
	script.Parent.Parent.Parent.Parent.Lighting.SunRays.Intensity = 0.007
	script.Parent.Parent.Parent.Parent.Lighting.SunRays.Spread = 0.63
	--activate half rain skybox
	script.Parent.Parent.Parent.Parent.Lighting.Sky.SunTextureId = ("")
	script.Parent.Parent.Parent.Parent.Lighting.Sky.StarCount = 200
	script.Parent.Parent.Parent.Parent.Lighting.Sky.SunAngularSize = 0
	script.Parent.Parent.Parent.Parent.Lighting.Sky.MoonAngularSize = 1
	script.Parent.Parent.Parent.Parent.Lighting.Sky.MoonTextureId = ("")
	script.Parent.Parent.Parent.Parent.Lighting.Sky.SkyboxBk = ("http://www.roblox.com/asset/?id=4495864450")
	script.Parent.Parent.Parent.Parent.Lighting.Sky.SkyboxDn = ("http://www.roblox.com/asset/?id=4495864887")
	script.Parent.Parent.Parent.Parent.Lighting.Sky.SkyboxFt = ("http://www.roblox.com/asset/?id=4495865458")
	script.Parent.Parent.Parent.Parent.Lighting.Sky.SkyboxLf = ("http://www.roblox.com/asset/?id=4495866035")
	script.Parent.Parent.Parent.Parent.Lighting.Sky.SkyboxRt = ("http://www.roblox.com/asset/?id=4495866584")
	script.Parent.Parent.Parent.Parent.Lighting.Sky.SkyboxUp = ("http://www.roblox.com/asset/?id=4495867486")
	wait(12) --Change this to how long you think the cloudy sky should last
	--activate rain skybox
	script.Parent.Parent.Parent.Parent.Lighting.Sky.SunTextureId = ("")
	script.Parent.Parent.Parent.Parent.Lighting.Sky.StarCount = 0
	script.Parent.Parent.Parent.Parent.Lighting.Sky.SunAngularSize = 1
	script.Parent.Parent.Parent.Parent.Lighting.Sky.MoonAngularSize = 1
	script.Parent.Parent.Parent.Parent.Lighting.Sky.MoonTextureId = ("")
	script.Parent.Parent.Parent.Parent.Lighting.Sky.SkyboxBk = ("http://www.roblox.com/asset/?id=4498828382")
	script.Parent.Parent.Parent.Parent.Lighting.Sky.SkyboxDn = ("http://www.roblox.com/asset/?id=4498828812")
	script.Parent.Parent.Parent.Parent.Lighting.Sky.SkyboxFt = ("http://www.roblox.com/asset/?id=4498829917")
	script.Parent.Parent.Parent.Parent.Lighting.Sky.SkyboxLf = ("http://www.roblox.com/asset/?id=4498830911")
	script.Parent.Parent.Parent.Parent.Lighting.Sky.SkyboxRt = ("http://www.roblox.com/asset/?id=4498830417")
	script.Parent.Parent.Parent.Parent.Lighting.Sky.SkyboxUp = ("http://www.roblox.com/asset/?id=4498831746")
	--activating rain
	wait(12) --Change this to how long you want the rainy sky box to last before it starts to rain
	print("Activate Rate")
	script.Parent.Parent.Parent.Parent.Workspace.Camera.__RainEmitter.RainStraight.Rate = 600
	script.Parent.Parent.Parent.Parent.Workspace.Camera.__RainEmitter.RainTopDown.Rate = 600
	print("Activate Sound")
	script.Parent.Parent.Parent.Parent.SoundService.__RainSoundGroup.Volume = 0.2
	print("Activate RainScript")
	script.Parent.RainScript.Disabled = false

	wait(200) --Change this to how long you want it to rain before it stops

	--Disable rain
	print("Disable Rate")
	script.Parent.Parent.Parent.Parent.Workspace.Camera.__RainEmitter.RainStraight.Rate = 0
	script.Parent.Parent.Parent.Parent.Workspace.Camera.__RainEmitter.RainTopDown.Rate = 0
	print("Disable Sound")
	script.Parent.Parent.Parent.Parent.SoundService.__RainSoundGroup.Volume = 0
	print("Disable RainScript")
	script.Parent.RainScript.Disabled = true
	--activate half rain skybox
	script.Parent.Parent.Parent.Parent.Lighting.Sky.StarCount = 200
	script.Parent.Parent.Parent.Parent.Lighting.Sky.SunTextureId = ("")
	script.Parent.Parent.Parent.Parent.Lighting.Sky.SunAngularSize = 0
	script.Parent.Parent.Parent.Parent.Lighting.Sky.MoonAngularSize = 1
	script.Parent.Parent.Parent.Parent.Lighting.Sky.MoonTextureId = ("")
	script.Parent.Parent.Parent.Parent.Lighting.Sky.SkyboxBk = ("http://www.roblox.com/asset/?id=4495864450")
	script.Parent.Parent.Parent.Parent.Lighting.Sky.SkyboxDn = ("http://www.roblox.com/asset/?id=4495864887")
	script.Parent.Parent.Parent.Parent.Lighting.Sky.SkyboxFt = ("http://www.roblox.com/asset/?id=4495865458")
	script.Parent.Parent.Parent.Parent.Lighting.Sky.SkyboxLf = ("http://www.roblox.com/asset/?id=4495866035")
	script.Parent.Parent.Parent.Parent.Lighting.Sky.SkyboxRt = ("http://www.roblox.com/asset/?id=4495866584")
	script.Parent.Parent.Parent.Parent.Lighting.Sky.SkyboxUp = ("http://www.roblox.com/asset/?id=4495867486")
	wait(12) -- this is how long it takes before it changes back to a clear sky
	--Adding daylight lighting
	script.Parent.Parent.Parent.Parent.Lighting.Ambient = Color3.fromRGB(112, 112, 112)
	script.Parent.Parent.Parent.Parent.Lighting.Brightness = 3.93
	script.Parent.Parent.Parent.Parent.Lighting.ColorShift_Top = Color3.fromRGB(118, 117, 101)
	script.Parent.Parent.Parent.Parent.Lighting.EnvironmentDiffuseScale = 0.343
	script.Parent.Parent.Parent.Parent.Lighting.EnvironmentSpecularScale = 1
	script.Parent.Parent.Parent.Parent.Lighting.ExposureCompensation = 0.34

	script.Parent.Parent.Parent.Parent.Lighting.Bloom.Intensity = 0.15
	script.Parent.Parent.Parent.Parent.Lighting.Bloom.Size = 7
	script.Parent.Parent.Parent.Parent.Lighting.SunRays.Intensity = 0.117
	script.Parent.Parent.Parent.Parent.Lighting.SunRays.Spread = 1
	--activate daylight skybox
	script.Parent.Parent.Parent.Parent.Lighting.Sky.StarCount = 3000
	script.Parent.Parent.Parent.Parent.Lighting.Sky.SunTextureId = ("rbxasset://sky/sun.jpg")
	script.Parent.Parent.Parent.Parent.Lighting.Sky.SunAngularSize = 10
	script.Parent.Parent.Parent.Parent.Lighting.Sky.MoonAngularSize = 11
	script.Parent.Parent.Parent.Parent.Lighting.Sky.MoonTextureId = ("rbxasset://sky/moon.jpg")
	script.Parent.Parent.Parent.Parent.Lighting.Sky.SkyboxBk = ("http://www.roblox.com/asset?id=153258865")
	script.Parent.Parent.Parent.Parent.Lighting.Sky.SkyboxDn = ("http://www.roblox.com/asset?id=153259937")
	script.Parent.Parent.Parent.Parent.Lighting.Sky.SkyboxFt = ("http://www.roblox.com/asset?id=153258844")
	script.Parent.Parent.Parent.Parent.Lighting.Sky.SkyboxLf = ("http://www.roblox.com/asset?id=153258851")
	script.Parent.Parent.Parent.Parent.Lighting.Sky.SkyboxRt = ("http://www.roblox.com/asset?id=153259421")
	script.Parent.Parent.Parent.Parent.Lighting.Sky.SkyboxUp = ("http://www.roblox.com/asset?id=153259943")
	wait(60) --Change this to how long you want the clear sky should last before it can rain again
end

while true do
	local lighting = game:GetService("Lighting")
	local currentTime = lighting.ClockTime

	if currentTime >= 14 and currentTime < 14.0167 then -- Check if it's 1 pm (13:00) in game time
		-- Start the rain cycle here
		RainCycle()
		print("It's 1 pm in game time. Starting the rain cycle.")
	end

	wait(1) -- Check the time every 60 seconds (1 in-game hour)
end
``` Lua


the bottom is my attempt at making a timer check.  I would rather have it rain about every 8 minutes for everyone.
1 Like

and why is it not posting correctly with the …lua command

script.Parent.Parent.Parent.Parent.Lighting.Sky

its ``` to post code lol (Wow thats alot of “parent”)

You might want to establish a local for that, just to clean things up
local Lighting = script.Parent.Parent.Parent.Parent.Lighting

yeah its not mine, it can be cleaned a lot. I was just wondering who to get this to work globally

1 Like