You can write your topic however you want, but you need to answer these questions:
-
What do you want to achieve? Keep it simple and clear!
I need help making a LocalScript enable when the .Value = “Rain” and so the LocalScript disables when the .Value is no longer “Rain” -
What is the issue? Include screenshots / videos if possible!

I’m trying to mess around so it enables the localscript so the rain script shows up in game play footage, but Idk… It doesn’t give any errors or warnings in both the Client and Server Console. - What solutions have you tried so far? Did you look for solutions on the Developer Hub?
As stated above in number 2
Time Of Day Weather Handler:
local Source = script.Parent.Parent
local RBXAnimator = require(script.RBXAnimator)
local Lighting = game.Lighting
local Weather = workspace.Mechanics.Weather
local WeatherType = Weather.Type
local WeatherHandler = {}
function WeatherHandler:Init()
spawn(function()
while wait(1) do
local Chance = math.random(1,1000)
if Chance <= 15 and WeatherType.Value == "Clear" then
WeatherType.Value = "Hurricane"
Weather.TimeRemaining.Value = 300
game.StarterPack.RainScript.Disabled = true
spawn(function()
RBXAnimator.Tween(game.Lighting, "FogEnd", 200, "InCubic", 5)
end)
elseif Chance <= 30 and WeatherType.Value == "Clear" then
WeatherType.Value = "Rain"
Weather.TimeRemaining.Value = 300
game.StarterPack.RainScript.Disabled = false
spawn(function()
RBXAnimator.Tween(game.Lighting, "FogEnd", 600, "InCubic", 5)
end)
elseif Chance <= 0 and WeatherType.Value == "Clear" then
WeatherType.Value = "Snow"
Weather.TimeRemaining.Value = 300
game.StarterPack.RainScript.Disabled = true
spawn(function()
RBXAnimator.Tween(game.Lighting, "FogEnd", 400, "InCubic", 5)
end)
elseif Weather.TimeRemaining.Value > 0 then
Weather.TimeRemaining.Value = Weather.TimeRemaining.Value - 1
elseif Weather.TimeRemaining.Value == 0 and WeatherType.Value ~= "Clear" then
WeatherType.Value = "Clear"
game.StarterPack.RainScript.Disabled = true
spawn(function()
RBXAnimator.Tween(game.Lighting, "FogEnd", 1700, "InCubic", 5)
end)
elseif WeatherType.Value == "Clear" then
wait(120)
end
end
end)
end
return WeatherHandler
The WeatherRender.Weather that does the rest:
local TweenService = game:GetService("TweenService")
local Player = game.Players.LocalPlayer
local Character = Player.Character
local Camera = workspace.CurrentCamera
local Mechanics = workspace.Mechanics
local Weather = Mechanics.Weather
local WeatherSounds = script.Parent
local TimeD = Weather.Time
local CurrentType = nil
local goal = {}
goal.BackgroundTransparency = 1
local tweenInfo = TweenInfo.new(0.35)
local RBXAnimator = require(script.RBXAnimator)
if workspace.CurrentCamera:FindFirstChild("WeatherBrick") then workspace.CurrentCamera.WeatherBrick:Destroy() end
local WeatherBrick = game:GetService("ReplicatedStorage"):WaitForChild("WeatherBrick"):Clone()
local Camera = workspace.CurrentCamera
pcall(function()
WeatherBrick.Parent = Camera
end)
FadeOut = function(Sound)
local Final = {}
Final.Volume = 0
local tweenInfo = TweenInfo.new(5)
local tweenVolme = TweenService:Create(Sound, tweenInfo, Final)
tweenVolme:Play()
tweenVolme:Destroy()
end
FadeIn = function(Sound)
local Final = {}
Final.Volume = Sound.FinalVolume.Value
local tweenInfo = TweenInfo.new(5)
local tweenVolme = TweenService:Create(Sound, tweenInfo, Final)
tweenVolme:Play()
tweenVolme:Destroy()
end
local roof = {
part = nil,
position = nil
}
roof.detect = function()
if Character:FindFirstChild('HumanoidRootPart') then
local ignore = {Character,workspace.CurrentCamera}
local ray = Ray.new(Camera.CFrame.Position,Vector3.new(0,75,0))
local hit,pos = workspace:FindPartOnRayWithIgnoreList(ray,ignore)
if hit and not hit:IsDescendantOf(Camera) then
if hit.CanCollide == true then
roof.part = hit
roof.position = pos
end
else
roof.part = nil
roof.position = nil
end
end
end
while wait(0.2) do
roof.detect()
if Weather.Type.Value ~= "Clear" then
if Weather.Type.Value ~= CurrentType then -- IF CHANGE FROM CONDITION A TO B
for Index,Object in pairs(WeatherBrick:GetChildren()) do if Object.Name == CurrentType then Object.Enabled = false end end
if WeatherBrick.Transparency == 0 then RBXAnimator.Tween(WeatherBrick, "Transparency", 1, "InCubic", 2.5) end
end
CurrentType = Weather.Type.Value
WeatherBrick.CFrame = CFrame.new(Camera.CFrame.Position) + Vector3.new(0,75,0)
if roof.part then -- IF INDOOR
for Index,Object in pairs(WeatherBrick:GetChildren()) do if Object.Name == CurrentType then Object.Enabled = false end end
if WeatherBrick.Transparency == 0 then RBXAnimator.Tween(WeatherBrick, "Transparency", 1, "InCubic", 2.5) end
else -- IF OUTDOOR
for Index,Object in pairs(WeatherBrick:GetChildren()) do if Object.Name == CurrentType then Object.Enabled = true end end
if WeatherBrick.Transparency == 1 then RBXAnimator.Tween(WeatherBrick, "Transparency", 0, "InCubic", 2.5) end
end
if WeatherSounds.ClearIndoor.Volume == WeatherSounds.ClearIndoor.FinalVolume.Value then
FadeOut(WeatherSounds.ClearIndoor)
end
if WeatherSounds.ClearOutdoor.Volume == WeatherSounds.ClearOutdoor.FinalVolume.Value then
FadeOut(WeatherSounds.ClearOutdoor)
end
if WeatherSounds.ClearNightIndoor.Volume == WeatherSounds.ClearNightIndoor.FinalVolume.Value then
FadeOut(WeatherSounds.ClearNightIndoor)
end
if WeatherSounds.ClearNightOutdoor.Volume == WeatherSounds.ClearNightOutdoor.FinalVolume.Value then
FadeOut(WeatherSounds.ClearNightOutdoor)
end
elseif CurrentType then -- IF CONDITION ENDS
for Index,Object in pairs(WeatherBrick:GetChildren()) do if Object.Name == CurrentType then Object.Enabled = false end end
if WeatherBrick.Transparency == 0 then RBXAnimator.Tween(WeatherBrick, "Transparency", 1, "InCubic", 2.5) end
CurrentType = nil
end
--if Weather.Type.Value == "Rain" then
--if roof.part then
---- if WeatherSounds.RainIndoor.Volume == 0 then
-- WeatherSounds.RainIndoor:Play()
-- FadeIn(WeatherSounds.RainIndoor)
-- FadeOut(WeatherSounds.RainOutdoor)
-- end
-- elseif WeatherSounds.RainOutdoor.Volume == 0 then
-- WeatherSounds.RainOutdoor:Play()
-- FadeOut(WeatherSounds.RainIndoor)
-- FadeIn(WeatherSounds.RainOutdoor)
-- end
if Weather.Type.Value == "Rain" then
game.StarterPack.RainScript.Disabled = false
elseif Weather.Type.Value == "Snow" then
game.StarterPack.RainScript.Disabled = true
if roof.part then
if WeatherSounds.SnowIndoor.Volume == 0 then
WeatherSounds.SnowIndoor:Play()
FadeIn(WeatherSounds.SnowIndoor)
FadeOut(WeatherSounds.SnowOutdoor)
end
elseif WeatherSounds.SnowOutdoor.Volume == 0 then
WeatherSounds.SnowOutdoor:Play()
FadeOut(WeatherSounds.SnowIndoor)
FadeIn(WeatherSounds.SnowOutdoor)
end
elseif Weather.Type.Value == "Hurricane" then
game.StarterPack.RainScript.Disabled = true
if roof.part then
if WeatherSounds.HurricaneIndoor.Volume == 0 then
WeatherSounds.HurricaneIndoor:Play()
FadeIn(WeatherSounds.HurricaneIndoor)
FadeOut(WeatherSounds.HurricaneOutdoor)
end
elseif WeatherSounds.HurricaneOutdoor.Volume == 0 then
WeatherSounds.HurricaneOutdoor:Play()
FadeOut(WeatherSounds.HurricaneIndoor)
FadeIn(WeatherSounds.HurricaneOutdoor)
end
elseif Weather.Type.Value == "Clear" then
game.StarterPack.RainScript.Disabled = true
for i,v in pairs(WeatherSounds:GetChildren()) do if v:IsA("Sound") and v.Name ~= "ClearOutdoor" and v.Name ~= "ClearNightOutdoor" then if v.Volume == v.FinalVolume.Value then FadeOut(v) end end end
for i,v in pairs(WeatherSounds:GetChildren()) do if v:IsA("Sound") and v.Name ~= "ClearOutdoor" and v.Name ~= "ClearNightOutdoor" then if v.Volume == 0 then v:Stop() end end end
if roof.part then
if WeatherSounds.ClearIndoor.Volume == 0 and TimeD.Value ~= "Night" then
game.StarterPack.RainScript.Disabled = true
WeatherSounds.ClearIndoor:Play()
FadeIn(WeatherSounds.ClearIndoor)
FadeOut(WeatherSounds.ClearOutdoor)
FadeOut(WeatherSounds.ClearNightIndoor)
FadeOut(WeatherSounds.ClearNightOutdoor)
elseif WeatherSounds.ClearNightIndoor.Volume == 0 and TimeD.Value == "Night" then
game.StarterPack.RainScript.Disabled = true
WeatherSounds.ClearNightIndoor:Play()
FadeIn(WeatherSounds.ClearNightIndoor)
FadeOut(WeatherSounds.ClearNightOutdoor)
FadeOut(WeatherSounds.ClearIndoor)
FadeOut(WeatherSounds.ClearOutdoor)
end
elseif WeatherSounds.ClearOutdoor.Volume == 0 and TimeD.Value ~= "Night" then
game.StarterPack.RainScript.Disabled = true
WeatherSounds.ClearOutdoor:Play()
FadeOut(WeatherSounds.ClearIndoor)
FadeIn(WeatherSounds.ClearOutdoor)
FadeOut(WeatherSounds.ClearNightIndoor)
FadeOut(WeatherSounds.ClearNightOutdoor)
elseif WeatherSounds.ClearNightOutdoor.Volume == 0 and TimeD.Value == "Night" then
game.StarterPack.RainScript.Disabled = true
WeatherSounds.ClearNightOutdoor:Play()
FadeOut(WeatherSounds.ClearNightIndoor)
FadeIn(WeatherSounds.ClearNightOutdoor)
FadeOut(WeatherSounds.ClearIndoor)
FadeOut(WeatherSounds.ClearOutdoor)
end
end
end
