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

How do I change a NumberValue when a text property = 0?

Asked by 10 years ago

This is what I tried:

while true do
    wait(0.2)
    if script.Parent.Parent.Countdown.Text = "0" then -- error :/
        script.Parent.Value = true
    end
end

The error reads "Expected 'then', got '='"

2
For conditions, it needs a double equals. ("==") not "=" Tkdriverx 514 — 10y
0
Oh! Thank you! SchonATL 15 — 10y

2 answers

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

= is used for assignment. That is, it sets the name at the left with the value on the right.

== is used for comparison. It is an operator that compares the left value with the right value.


Because = forms a full statement but the condition of an if requires an expression, it says it thinks you forgot the then, as in

if a == b
    c = d

(It expected to see a then before getting =)

Ad
Log in to vote
0
Answered by
Tkdriverx 514 Moderation Voter
10 years ago

I recommend using this Wiki page.

Answer this question