I am making an scp door with different assets, new opening, and stuff. But whenever I open the big gate, the rightdoor seems to delay, the left door opens when the door sound plays, but the right door opens when the left door has opened fully. can anyone help?
--<tkcmdr>--
--"False" = Not Acceptable Keycard To Open. "True" = Acceptable Keycard To Open.--
local bool = true
local bool2 = true
local clearance = {
["Card"] = false,
["Gate Card"] = true,
}
--DO NOT EDIT BEYOND THIS LINE--
local LeftDoor = script.Parent
local RightDoor = script.Parent.Parent.RightDoor
local Open = false
local OpenSound = script.Parent.DoorOpen
local CloseSound = script.Parent.DoorClose
local Debounce = false
function openDoor()
if not Debounce then
Debounce = true
if Open then
Open = false
CloseSound:Play()
wait(13)
Spawn(function()
script.Parent.Parent.Parent.ScriptedComponents.test["Sand-SandParticle"].Enabled = true
for i = 1, 130 do
LeftDoor.CFrame = LeftDoor.CFrame + (LeftDoor.CFrame.lookVector * 0.1)
wait(0.05)
end
end)
wait(13)
Spawn(function()
for i = 1, 130 do
RightDoor.CFrame = RightDoor.CFrame + (RightDoor.CFrame.lookVector * 0.1)
script.Parent.Parent.Parent.ScriptedComponents.test["Sand-SandParticle"].Enabled = false
wait(0.05)
end
end)
else
Open = true
OpenSound:Play()
wait(13)
Spawn(function()
script.Parent.Parent.Parent.ScriptedComponents.test["Sand-SandParticle"].Enabled = true
for i = 1, 130 do
LeftDoor.CFrame = LeftDoor.CFrame - (LeftDoor.CFrame.lookVector * 0.1)
wait(0.05)
end
end)
wait(13)
Spawn(function()
for i = 1, 130 do
RightDoor.CFrame = RightDoor.CFrame - (RightDoor.CFrame.lookVector * 0.1)
wait(0.05)
script.Parent.Parent.Parent.ScriptedComponents.test["Sand-SandParticle"].Enabled = false
end
end)
end
wait(2.5)
Debounce = false
end
end
script.Parent.Parent.KeycardReader1.touched:connect(function(touch)
if touch.Name == "Handle" and clearance[touch.Parent.Name] and bool then
bool = false
script.Parent.AccessGranted:play()
wait(0.75)
openDoor()
wait(3)
bool = true
elseif touch.Name == "Handle" and not clearance[touch.Parent.Name] and bool2 then
bool2 = false
script.Parent.AccessDenied:play()
wait(1)
bool2 = true
end
end)
script.Parent.Parent.KeycardReader2.touched:connect(function(touch)
if touch.Name == "Handle" and clearance[touch.Parent.Name] and bool then
bool = false
script.Parent.AccessGranted:play()
wait(0.75)
openDoor()
wait(3)
bool = true
elseif touch.Name == "Handle" and not clearance[touch.Parent.Name] and bool2 then
bool2 = false
script.Parent.AccessDenied:play()
wait(1)
bool2 = true
end
end)
Please help.
