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)
