Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Day night cycle
- -- Put in ServerScriptService
- local lighting = game:GetService("Lighting")
- local tweenService = game:GetService("TweenService")
- local dayLength = 250 -- How many real-time seconds an in-game day will last
- local nightLength = 150 -- How many real-time seconds an in-game night will last
- function tween (l, p)
- tweenService:Create(lighting, TweenInfo.new(l, Enum.EasingStyle.Linear, Enum.EasingDirection.In), p):Play()
- end
- lighting.ClockTime = 6
- while dayLength ~= nil do
- tween(dayLength, {ClockTime = 18})
- wait(dayLength)
- tween(4, {OutdoorAmbient = Color3.new(60/255, 60/255, 60/255), FogColor = Color3.new(25/255, 25/255, 25/255), FogEnd = 700})
- tween(nightLength / 2, {ClockTime = 24})
- wait(nightLength / 2)
- tween(nightLength / 2, {ClockTime = 6})
- wait(nightLength / 2)
- tween(4, {OutdoorAmbient = Color3.new(140/255, 140/255, 140/255), FogColor = Color3.new(195/255, 195/255, 195/255), FogEnd = 4500})
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement