so i have a script that uses math.random to choose if there is going to be rain in the map but i’m not sure how to change the value every one second. How can i do this?
local lighting = game:GetService("Lighting")
local SS = game:GetService("ServerStorage")
local chanceOfRain = math.random(1,15)
local minutes = 7 * 60
while wait() do
lighting:SetMinutesAfterMidnight(minutes)
minutes = lighting:GetMinutesAfterMidnight()
minutes = minutes + .1
if minutes > 19 * 60 then
minutes = minutes + 3
elseif minutes > 7 * 60 then
minutes = minutes + 1
else
minutes = minutes + 3
end
if chanceOfRain == math.random(1,15) then
local rain = SS:WaitForChild("Rain"):Clone()
rain.Parent = workspace
workspace.RainSounds:Play()
workspace.RainSounds.Looped = true
wait(math.random(50, 200))
rain:Destroy()
workspace.RainSounds:Stop()
end
end