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

Why doesn't my code doesn't change the time properly?

MinutesAfterNight = 0

while true do
	wait(0.1)
	MinutesAfterNight = MinutesAfterNight + 1
	game.Lighting:MinutesAfterMidnight = MinutesAfterNight
end

It's supposed to set the time to midnight, wait .1 seconds, and then change it 1 minute ahead, and repeat

The script is in serverscriptstorage. No other scripts interfere with it.

1 comment

0

It's game.Lighting:SetMinutesAfterMidnight, you forgot the "Set"

1 answer

It looks like you're trying to use the :SetMinutesAfterMidnight() method. This isn't something you assign to, it's something you call. When you're calling a function or method, you do not use the = operator. Instead, you invoke it with () and any required arguments.

The proper usage looks like this:

game.Lighting:SetMinutesAfterMidnight(MinutesAfterNight)

You can find plenty of examples on how to use that here.

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