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

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

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 comments

2

For conditions, it needs a double equals. ("==") not "="

0

Oh! Thank you!

2 answers

✓ Accepted answer

= 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 =)

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