can u add wait(8.5) in there
can u debounce open door and close door coz they arent the same function, (the door either opens or closes not both)
local hit = false
local keycard = "Keycard"
script.Parent.Touched:Connect(function(hit)
local character = hit.Parent
local player = game.Players:GetPlayerFromCharacter(character)
if player then
local backpack = player.Backpack if backpack:FindFirstChild(keycard) or character:FindFirstChild(keycard) then
print("opendoor")
else
print("closedoor")
end
end
end)
Code blocks are these ~~~~~~~~~~~~~~~~~
Edit: I did 2 things wrong. Sorry, problem 1 was that the debounce variable name was the same as the name of the input. Problem 2, I didn't even use the debounce as a checking point.
local inside = false local keycard = "Keycard" script.Parent.Touched:Connect(function(hit) local character = hit.Parent local player = game.Players:GetPlayerFromCharacter(character) if player and inside == false then inside = true local backpack = player.Backpack if backpack:FindFirstChild(keycard) or character:FindFirstChild(keycard) then print("opendoor") else print("closedoor") end wait(8.5) inside = false end end)