I am trying to basically make a key card so when the key card touches the door the door’s collision turns off.
When it touches again the doors collision turns on again.
I am trying to basically make a key card so when the key card touches the door the door’s collision turns off.
When it touches again the doors collision turns on again.
Put the script inside the Door
local Door = script.Parent
local Debounce = false
Door.Touched:Connect(function(Hit)
if (Hit.Parent.Name == "Keycard") and (Hit.Parent:IsA("Tool")) and (Debounce == false) then
task.spawn(function()
Debounce = true
task.wait(0.7)
Debounce = false
end)
Door.CanCollide = not Door.CanCollide
end
end)
Do I need to add a TouchInterest in the handle tool?
Nope just change the tools name to Keycard
Ok, so in the tool is a handle.
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.