I know this isn't entirely my script but I have edited to make the door go up instead of left or right but the script is broken, the door does manage to go up but it wont go down it just stays there.... So I was wondering if anyone could help me evaluate and identify this problem.

Thank you,

Script:


local bool = true
local bool2 = true
local clearance = {
	["[SCP] Card-Omni"] = true, 
	["[SCP] Card-L5"] = true, 
	["[SCP] Card-L4"] = true,
	["[SCP] Card-L3"] = true,
	["[SCP] MTF Access Card"] = true,
	["[SCP] Card-L1"] = false,
	["GamepassCard"] = true
}

local door = script.Parent
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()
			Spawn(function()
				for i = 1, 38 do
					door.CFrame = door.CFrame - Vector3.new(0, 0.2, 0)
					wait(0.05)
					Spawn(function()
						door.CFrame = door.CFrame - Vector3.new(0, 0, 0)
						wait(0.05)
						
					end)
				end
			end)
		else
			Open = true
			OpenSound:Play()
			Spawn(function()
				for i = 1, 38 do
					door.CFrame = door.CFrame + Vector3.new(0, 0.2, 0)
					wait(0.05)
					Spawn(function()
						door.CFrame = door.CFrame + Vector3.new(0, 0, 0)
						wait(0.05)
						
					end)
				end
			end)
				end
			end
		end
		wait(2.5)
		Debounce = false

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()
		openDoor()
		wait(3)
		openDoor()
		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()
		openDoor()
		wait(3)
		openDoor()
		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)


1 comment

0

I suggest taking out all of the extra code and just having all of the CFrame functions so we don't have to look at the whole script