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

Why won't the Value of the NumberValue won't change?

I was planning to make a time thing,but the the value of NumberValue won't change for some reason.

-------Spawns Value-------
value = Instance.new("NumberValue",script)--Spawns the value
value.Name = "Number"
-------Varibles-----------
label = script.Parent
Number = value.Value
--------------------------
for Seconds = 0,600/10,1 do
	wait(1)
	Number = "0"..":"..Seconds .."-".."1:25"--Current time,will start at 0:0 - 1:25
	print("0"..":"..Seconds.."-".."1:25")
end

1 answer

✓ Accepted answer

This will modify the value of the variable Number. However, this value is never written out.

The assignment on 06 is equivalent to Number = 0 since, at that time, that is the value of the expression value.Value.

This does not somehow link value.Value and Number together: the expression on the right, value.Value is just a number

In your loop, you can just add

value.Value = Number; after the new assignment to Number and it will be written out as you expect.


Other things: it would be better practice to print Number instead of that concatenation. That way, if things change, you get a consistent output.

Also, the third numbers in a for loop is by default 1. You do not need to specify it explicitly and probably shouldn't.

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