I am trying to create a door that will open and close upon being clicked. To stop the door opening/closing parts from being able to appear at the same time, I used an if statement.
function OnClick()
if script.Parent.Parent.Door1.Transparency == 1 then
script.Parent.CanCollide = false
script.Parent.Parent.Door2.Transpareny = 1
script.Parent.Parent.Door1.Transparency = 0
end
end
The scripts are the door's children. I've done this for both doors. They use a seperate script. One script ignores the if statement and proceeds to make itself non-transparent, and the Other responds with "Transparency is not a valid member of UnionOperation"
Without the if statement, they will work, but can be activated at the same time. I know it is a very simple script, but it is a little hurdle I am struggling to overcome. Any help would be appreciated.
EDIT: All and solved. Thanks for letting me know the issues and the alternatives!

1 comment
And if the door is a model or union then the script will not work since transparency and Can collide isn't a valid member of a model object