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

I get an" 'then' expected near '=' " output error in my script? Why exactly?

local tensplace = script.Parent.Frame.ImageLabel
local onesplace = script.Parent.OnePlace

if tensplace.Position = UDim2.new(0,-1,0,0) then --If the tens place spritesheet  is only showing 0,
	onesplace.Position = UDim2.new(0,89,0,-5) --the ones place spritesheet image moves closer to the tens place image. so the spritesheet images don't look too separated..
end

if tensplace.Position = UDim2.new(0,-31,0,0) then
	onesplace.Position = UDim2.new(0,86,0,-5)
end
		
		

--if tens place is 1 {0, 86},{0, -5}
--if tens place is 0 {0, 89},{0, -5}

Output error: line 4, expected near '='

Why though, this does not make sense to me???

1 comment

1

First off that error is meant to be their, when you use if, image that you want to declare something, then you use == instead of =, that should solve the problem 100% change where their is an = in an if statement to ==

2 answers

✓ Accepted answer

You should be using == to check whether two items are equal, not =

= is for setting values, while == is for comparing

Putting just a single = isn't correct, you need to put == to compare, also change this for other comparisons using = instead of ==

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