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

Value not changing when another value reaches a number?

Asked by 4 years ago

I am trying to make value1 +1 when value0 reaches 100, though it doesn't work.

val0 = script.Parent.val0
val1 = script.Parent.val1

while true do wait()
    if val0.Value == 100 then
        val1.Value =  val1.Value +1
    else

    end
end

Any help would be greatly appreciated. Thanks!

0
woops my answer was wrong WideSteal321 773 — 4y

1 answer

Log in to vote
0
Answered by 4 years ago

Hmm, I'm not quite sure why that didn't work for you, but try this:

val0 = script.Parent:WaitForChild("Val0");
val1 = script.Parent:WaitForChild("Val1");

while wait() do
    if val0.Value >= 100 then
        val1.Value = val1.Value + 1;    
    else
        print("Val0 is less than 100 ("..tostring(val0.Value)..")");
    end
end
0
Why would that help? Explain your answer and I'll remove the dislike. WideSteal321 773 — 4y
0
I'll remove the dislike anyways I don't want to be too harsh. WideSteal321 773 — 4y
0
It may not work, I'm not entirely sure. I never said it would 100% work, I was simply making a suggestion that could POSSIBLY fix his error. No worries, though. I understand where you're coming from. isaacsoccer 45 — 4y
Ad

Answer this question