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

Why won't the NumberValue in workspace change?

Asked by 6 years ago
local TimeInMinutes = 0

while true do
    wait(1)
    game.Lighting:SetMinutesAfterMidnight(1 * TimeInMinutes)
    TimeInMinutes = TimeInMinutes + 1
    if TimeInMinutes >= 1440 then
        TimeInMinutes = 0
    game.Workspace.TimeInMinutes.Value = game.Workspace.TimeInMinutes.Value + 1
    if game.Workspace.TimeInMinutes.Value >= 1440 then
        game.Workspace.TimeInMinutes.Value = 0
    end
    end
end

I'm trying to make a tracker using a NumberValue in workspace, but the game doesn't change the actual value, and I have no clue why. The Time of day changes flawlessly.

0
Are you sure you waited at least 1440 seconds? The if-statement at line 7 will not execute until after 1440 seconds. I would recommend setting the waiting time lower and seeing what happens. XAXA 1569 — 6y

1 answer

Log in to vote
0
Answered by 6 years ago
local TimeInMinutes = 0

while true do
    wait(1)
    game.Lighting:SetMinutesAfterMidnight(1 * TimeInMinutes)
    TimeInMinutes = TimeInMinutes + 1
    if TimeInMinutes >= 1440 then
        TimeInMinutes = 0
        end
    game.Workspace.TimeInMinutes.Value = game.Workspace.TimeInMinutes.Value + 1
    if game.Workspace.TimeInMinutes.Value >= 1440 then
        game.Workspace.TimeInMinutes.Value = 0
    end
end

I had my ends wrong so it kept waiting for TimeInMinutes to be greater than 1440 before it'd continue with the script.

Ad

Answer this question