At the moment I’m trying to make a random weather event fire after a certain period of time passes.
I’m new to scripting, I don’t know what I’m doing wrong here. When the script executes nothing happens. The print work but the actual change on the clouds doesn’t happen.
I’ve looked for tutorials on how to use TweenService but I just can’t get it. All of my local values are correct, all goto where they need to be.
local c=game.Workspace.Terrain.Clouds
local l=game.Lighting
local ts=game:GetService("TweenService")
local g={}
local ti=TweenInfo.new(5)
local t=ts:Create(c,ti,g)
local function weather()
local r=math.random(1,3)
if r==1 then
g.Cover=0.8
g.Density=1
g.Color=Color3.new(0.196078, 0.196078, 0.196078)
l.FogStart = 0
l.FogEnd = 400
l.FogColor = Color3.new(1,1,1)
l.TimeOfDay = "15:00"
print("1")
end
if r==2 then
g.Cover=0.5
g.Density=1
g.Color=Color3.new(1, 1, 1)
l.FogStart = 0
l.FogEnd = 400
l.FogColor = Color3.new(1,1,1)
l.TimeOfDay = "15:00"
print("2")
end
if r==3 then
g.Cover=0.675
g.Density=1
g.Color=Color3.new(0.862745, 0.862745, 0.862745)
l.FogStart = 0
l.FogEnd = 400
l.FogColor = Color3.new(1,1,1)
l.TimeOfDay = "15:00"
print("3")
end
end
while true do
wait(6)
weather()
t:Play()
end