Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How do I make it so that the server starts at daytime and how do I change the length of night/day?

local minutesAfterMidnight = 0
while true do
	game.Lighting:SetMinutesAfterMidnight(minutesAfterMidnight)
	minutesAfterMidnight = minutesAfterMidnight + 1
	wait(0.1)
end

1 answer

✓ Accepted answer

local minutesAfterMidnight = 0

Think about it like seconds after daytime, say you want time to start the 7th hour (7am)

You'd want 7 hours into seconds so you can do something like:

local minutesAfterMidnight = 7 * 60 * 60

[EDIT]

If you wanted to have a ratio, so you could decide exactly how long a 24 hour cycle is you can use the below:

local dayLength = 24 
local cycleTime = dayLength * 60
local minutesInADay = 24 * 60 
local minutesToAdd = minutesInADay / cycleTime 

-- use this below in your while loop
minutesAfterMidnight += minutesToAdd

3 comments

0

yes thank you but how would i make it so say daytime is 24 minutes long

0

local dayLength = 24 local cycleTime = dayLength * 60 local minutesInADay = 24 * 60 local minutesToAdd = minutesInADay / cycleTime minutesAfterMidnight += minutesToAdd

0

is that a new script or just something i should add to it?

This discussion is preserved as it was. New answers, comments, and votes are closed.