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

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

Asked by 4 years ago
Edited 4 years ago
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.

0
It's game.Lighting:SetMinutesAfterMidnight, you forgot the "Set" WoTrox 345 — 4y

1 answer

Log in to vote
0
Answered by
Optikk 499 Donator Moderation Voter
4 years ago
Edited 4 years ago

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.

Ad

Answer this question