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

NumberValue , Is this the way how to add 1 to it? [ANSWERED]

Asked by 6 years ago
Edited 6 years ago

So, Ive made many questions about this topic but I still don't understand. I have made a script myself to test it out a little bit. This is what I made.

local Temp = game.Workspace.Temp.Value

while true do
    wait(2)
    Temp = Temp + 1
end

But It doens't seem to work. What I want to do is make it add +1 to the NumberValue called "Temp" every 2 seconds. Anyone knows what is wrong?

Best Regards, kyanoke11

1 answer

Log in to vote
0
Answered by 6 years ago

You are adding 1 to the variable Temp not the NumberValue object's value. When you do

local Temp = game.Workspace.Temp.Value

It sets Temp to the NumberValue's value. Then you are adding 1 to the Temp variable with your loop.

What you need to do is this

local Temp = game.Workspace.Temp

while true do
    wait(2)
    Temp.Value = Temp.Value + 1
end

0
Thank You! - Question answered kyanoke11 15 — 6y
0
No Problem justoboy13 153 — 6y
Ad

Answer this question