so I made this door, and it’s not working, i don’t know if there’s anything wrong with the script or something.
video below
local door = script.Parent
local CanOpen1 = true
local CanClose1 = false
local clearance = {
["[SCP] Card-Omni"] = true,
["[SCP] Card-L5"] = true,
["[SCP] Card-L4"] = true,
["[SCP] Card-L3"] = true,
["[SCP] Card-L2"] = true,
["[SCP] Card-L1"] = false
}
function openDoor()
for i = 0.02,(door.Size.z / 0.05) do
wait()
door.CFrame = door.CFrame - (door.CFrame.lookVector * -0.05)
end
end
function closeDoor()
for i = 0.02,(door.Size.z / 0.05) do
wait()
door.CFrame = door.CFrame + (door.CFrame.lookVector * -0.05)
end
end
script.Parent.Parent.KeycardReader1.touched:connect(function(touch)
if touch.Name == "Handle" and clearance[touch.Parent.Name] and CanOpen1 == true then
CanOpen1 = false
script.Parent.Parent.Light.BrickColor = BrickColor.new("Bright green")
script.Parent.Parent.Light1.BrickColor = BrickColor.new("Bright green")
wait(0.75)
openDoor()
wait(1)
CanClose1 = true
script.Parent.Parent.Light.BrickColor = BrickColor.new("Neon orange")
script.Parent.Parent.Light1.BrickColor = BrickColor.new("Neon orange")
elseif touch.Name == "Handle" and clearance[touch.Parent.Name] and CanClose1 == true then
CanClose1 = false
wait(0.75)
closeDoor()
wait(1)
CanOpen1 = true
end
end)
script.Parent.Parent.KeycardReader2.touched:connect(function(touch)
if touch.Name == "Handle" and clearance[touch.Parent.Name] and CanOpen1 == true then
CanOpen1 = false
wait(0.75)
openDoor()
wait(1)
CanClose1 = true
elseif touch.Name == "Handle" and clearance[touch.Parent.Name] and CanClose1 == true then
CanClose1 = false
script.Parent.Parent.Light.BrickColor = BrickColor.new("Bright green")
script.Parent.Parent.Light1.BrickColor = BrickColor.new("Bright green")
wait(0.75)
closeDoor()
wait(1)
CanOpen1 = true
script.Parent.Parent.Light.BrickColor = BrickColor.new("Neon orange")
script.Parent.Parent.Light1.BrickColor = BrickColor.new("Neon orange")
end
end)
here’s the video of the door
https://gyazo.com/e1912455fdbddf1e884191cbb27a37a8
ive tried everything i could, but that still didn’t work