Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

how to change daytime again?

Asked by 6 years ago

I know it seems confusing, but i'm trying to make it after 180 seconds it changes back to noon, can anyone help?


local minutes = 0 local hours = 0 while true do game.Lighting.TimeOfDay = hours.."20:00:00"..minutes --what is the changed time wait(script.WaitToAdd.Value) minutes = minutes + script.AddAmount.Value if minutes >= 60 then hours = hours + 1 minutes = 0 if hours >= 24 then hours = 0 end end end --i wanted to change it back to 12:00:00.
0
The problem's line 5. :P TheeDeathCaster 2368 — 6y
0
TimeOfDay is a string and not a number :| Konethorix 197 — 6y
0
You can use tostring() to turn numbers into string Konethorix 197 — 6y

1 answer

Log in to vote
0
Answered by
UgOsMiLy 1074 Moderation Voter
6 years ago

Is this what you're trying to do?

local RunService = game:GetService("RunService")
local hb = 1/60

local length = 360 -- Set this to how long, in seconds, you want the whole day to last for (from midnight back to midnight again.)

while true do
    game.Lighting:SetMinutesAfterMidnight(game.Lighting:GetMinutesAfterMidnight() + ((1440/length) * hb))
    hb = RunService.Heartbeat:Wait()
end
0
nah, i was thinking that like intermission when it switches to midnight at the end of the round it switches back to morning 12:00:00, i'm gonna try to incorporate it into my intermission script. thanks for helping! Joshuasol 2 — 6y
Ad

Answer this question