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

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

Asked by 9 years ago

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

Log in to vote
3
Answered by
BlueTaslem 18071 Moderation Voter Administrator Community Moderator Super Administrator
9 years ago

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.

Ad

Answer this question