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

Why won't the NumberValue in workspace change?

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.

1 comment

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.

1 answer

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.

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