How do I make this script lock the door after I close it? I tried reading on conditional statements on the API developer article but I just don’t understand it
Here’s the code and screenshot of the Explorer tab to get an idea. The door works fine mostly- but I can’t lock it after unlocking it by touching the door with the key tool.
door.Touched:connect(function(k)
if k.Parent.Name == "Master Key" then
clickDetector.MaxActivationDistance = 12
end
end)
script.Parent.DoorClick.ClickDetector.MouseClick:Connect(Open)
You may create a script when key touches door. The doors script just disables
if you touch again and locked value is true then its will enable the door script