I'm trying to make a script where when a keycard is put in, it will unlock the door, and once put back in it will lock the door again. So far the script only locks the door, here's the snippet. Sorry if my code is messy:
script.Parent.Touched:Connect(function(hit) if hit then if hit.Parent and hit.Parent.ClassName == "Tool" then if Clearance[hit.Parent.Name] then if locked.Value == true then if debounce then debounce = false locked.value = false print(locked.Value) wait(.2) debounce = true end end elseif locked.Value == false then if debounce then debounce = false locked.Value = true print(locked.Value) wait(.2) debounce = true end end end end end)