Having a strange problem here, I've created a script to open a door with a key.
function onTouched(hit)
if hit.Parent.Name == "Room1"
then script.Parent.CanCollide = false
wait(1)
script.Parent.CanCollide = true
end
end
script.Parent.Touched:connect(onTouched)
This works just fine, but I also want it to be opened by a master key. When I try to add that to the script, the door constantly goes collidable and noncollidable on a loop, even when I'm not holding anything.
function onTouched(hit)
if hit.Parent.Name == "Room1" or "MasterKey"
then script.Parent.CanCollide = false
wait(1)
script.Parent.CanCollide = true
end
end
script.Parent.Touched:connect(onTouched)
Please help?

2 comments
Thanks! This was the solution!
You should add a debounce too though...