Might be linked to a previous error I had before. When I click on the door, it should check that if the door is open (a variable stored in a folder, in the workspace , the folder is called VAR, the variable is called Door1Open) then it will close using Vector3, putting it back to its original position. Clicking it when Door1Open==false will then mean that the door opens to a new position and orientation (again, using Vector3). This is stored in a function (don't know if that makes a difference?) and the door is anchored. It's just not opening or closing, or playing any sound that I've coded. I would appreciate it if you had a look, thanks! The script is located inside of the Part, inside of the clickdetector.

local clickDetector=script.Parent

function onMouseClick()
	if game.Workspace.VAR.Door1Open==false then
		script.Parent.Parent.Position=Vector3.new(92.3, 17.697, 214.45)
		script.Parent.Parent.Orientation=Vector3.new(0, -135, 0)
		game.Workspace.SFX.DoorOpening:Play()
	elseif game.Workspace.VAR.Door1Open==true then
		script.Parent.Parent.Position=Vector3.new(86.95, 17.697, 216.05)
		script.Parent.Parent.Orientation=Vector3.new(0, 180, 0)
		game.Workspace.SFX.DoorOpening:Play()
	end
	end
	


clickDetector.MouseClick:connect(onMouseClick)

4 comments

0

Door1Open is probably an Object, which is neither true or false

0

try Door1Open.Value

0

and instead of elseif game.Workspace.VAR.Door1Open==true then, you can just do else

0

I specified that Door1Open was a variable ; it's a BoolValue. And else / elseif should really make a difference.