Can some tell me how to make a day night system with tweenservice

The title says what I want I just dont know how to do it :slight_smile:

You cant ask for scritps here btw, you need to try and then if it doesnt work then come here.

2 Likes

True it happened to me but I didnt know and I got flaged.

I have tried and failedddddddd

1 Like

Personally, I wouldnt use tween service for this. Mainly because when the clock goes back to 0 it will go from 23.99999 to 0. If using the clocktime.
I would use Runservice.Heartbeat and add the delta time to the clock time multiplied by the speed of the time. It should be smoother then other methods.
Here is some code for it to work. Just put the script in ServerScriptService or Workspace.

local DayTime = (24 / (60 * 4)) -- 4 is the value that a day cycle lasts for in minutes. (4 = 4 minutes, 0.5 = 30 seconds, ect.)
game:GetService("RunService").Heartbeat:Connect(function(DeltaTime)
	game.Lighting.ClockTime = game.Lighting.ClockTime + (DeltaTime * DayTime)
end)

Good luck! :slight_smile:

5 Likes
local lightning = game:GetService("Lighting") -- Getting the lightning propertie of the game

local minutes = 7 * 60 -- Change value for it to go faster/slower

while wait() do

  lightning:SetMinutesAfterMidnight(minutes)

  minutes = minutes + .01 -- How much you want it to add each loop

end

i dont think you should use tweenservice but i made a script that maybe will help you

Just to let you know OP, mark the message as the solution to close the post, as there are a few solutions already suggested.

Please don’t bump 17 days old posts

4 Likes