This worked fine previously. I just duplicated the door and moved it a bit. And now, it doesn't work anymore. It is supposed to remove the click function of a door so it is not openable anymore What did I do that broke it?
function onClicked()
script.Parent.Parent.Lock2.SurfaceGui.TextBox.Visible = false
script.Parent.Parent.Lock2.ClickDetector.MaxActivationDistance = 0
script.Parent.Parent.Unlock2.SurfaceGui.TextBox.Visible = true
script.Parent.Parent.Unlock2.ClickDetector.MaxActivationDistance = 8
script.Parent.Parent.Light.BrickColor = BrickColor.new("Bright red")
script.Parent.Parent.Union.ClickDetector.MaxActivationDistance = 0
script.Parent.Parent.Union2.ClickDetector.MaxActivationDistance = 0
end
script.Parent.ClickDetector.MouseClick:connect(onClicked)

3 comments
Anything said in the output, as long as your hierarchy is correct, this should work
What do you mean by hierarchy? I scripted this some time ago and I can't really remember stuff anymore :l
Did you turn on FilteringEnabled on your game? ClickDetectors do not work the same way when FilteringEnabled is on. You need to capture the click on the client and use a RemoteEvent or RemoteFunction to handle the click on the server.