I've got this door and I want to be able to swing it away from the direction of the player who opens it. I'm completely stumped on what to do. Ignore some weird code bits made to deactivate the failed code.
OPENING THE DOOR
script.Parent.ClickDetector.MouseClick:Connect(function() local t = script.Parent.Parent local function open(door) door.Transparency = 0 door.CanCollide = true end local function close(doorc) doorc.Transparency = 1 script.Parent.Transparency = 1 doorc.CanCollide = false end if script.DoorOpening.IsPlaying == false then if 1+1 == 3 then script.Parent.ClickDetector.MaxActivationDistance = 0 script.DoorOpening:Play() open(t.BDoor) close(t.Door) wait(0.01) open(t.B2Door) close(t.BDoor) wait(0.01) open(t.B3Door) close(t.B2Door) wait(0.01) open(t.B4Door) close(t.B3Door) script.Parent.Parent.B4Door.ClickDetector.MaxActivationDistance = 32 else script.Parent.ClickDetector.MaxActivationDistance = 0 script.DoorOpening:Play() open(t.Door2) close(t.Door) wait(0.01) open(t.Door3) close(t.Door2) wait(0.01) open(t.Door4) close(t.Door3) wait(0.01) open(t.Door5) close(t.Door4) wait(0.01) open(t.Door6) close(t.Door5) wait(0.01) open(t.Door7) close(t.Door6) script.Parent.Parent.Door7.ClickDetector.MaxActivationDistance = 32 end end end)
CLOSING THE DOOR
script.Parent.ClickDetector.MouseClick:Connect(function() local t = script.Parent.Parent local function open(door) door.Transparency = 0 door.CanCollide = true end local function close(doorc) doorc.Transparency = 1 script.Parent.Transparency = 1 doorc.CanCollide = false end if script.DoorClose.IsPlaying == false then if 1+1==3 then script.Parent.ClickDetector.MaxActivationDistance = 0 open(t.B3Door) close(t.B4Door) wait(0.01) open(t.B2Door) close(t.B3Door) wait(0.01) open(t.BDoor) close(t.B2Door) wait(0.01) open(t.Door) close(t.BDoor) script.Parent.Parent.Door.ClickDetector.MaxActivationDistance = 32 else script.Parent.ClickDetector.MaxActivationDistance = 0 script.DoorClose:Play() open(t.Door6) close(t.Door7) wait(0.01) open(t.Door5) close(t.Door6) wait(0.01) open(t.Door4) close(t.Door5) wait(0.01) open(t.Door3) close(t.Door4) wait(0.01) open(t.Door2) close(t.Door3) wait(0.01) open(t.Door) close(t.Door2) script.Parent.Parent.Door.ClickDetector.MaxActivationDistance = 32 end end end)
open + close, right? here's both. i think. only use a script and put this into the model
script.Parent.ClickDetector.MouseClick:Connect(function() --OPEN local function open(door) door.Orientation = Vector3.new(numberx,numbery,numberz) door.Position = Vector3.new(numberx,numbery,numberz) end --CLOSE local function close(door) door.Orientation = Vector3.new(numberx,numbery,numberz) --use original door.Position = Vector3.new(numberx,numbery,numberz) --use original end if script.Parent.Door.Orientation == Vector3.new(numberx,numbery,numberz) and script.Parent.Door.Position == Vector3.new(numberx,numbery,numberz) then --[[CLOSE (OPENING)]] open(script.Parent.Door) end if script.Parent.Door.Orientation == Vector3.new(numberx,numbery,numberz) and script.Parent.Door.Position == Vector3.new(numberx,numbery,numberz) then --[[OPEN (CLOSING)]] close(script.Parent.Door) end end