If x = x then (HELP)

I am trying to write a code that checks if a block’s transparency is equal to 1, and if it is then the can collide will be set to false. However when I try this;

local Part = script.Parent

if Part.Transparency = 1 then
	Part.CanCollide = false
else
	return
end

it does not work, any help would be great!

1 Like

A single equals sign is a declaration which is invalid within an if statement. You need two equals signs, which form an equality operator.

if Part.Transparency == 1 then

Some reading material from the Lua manual, 2.5.2 - Relational Operators.

2 Likes