I am trying to make a door that will close when a person with a certain tool clicks on a button. Only one player will have the tool, and they should have it equipped at all times. I can't get the button to work when the tool is equipped.
As of now, it is a part with a click detector inside. I'm not sure if I'm supposed to use MouseButton1Click for this.
local button = script.Parent door1 = workspace.Doors.Door1 function onClicked(playerWhoClicked) local tools = playerWhoClicked.Backpack:GetChildren() for i, tool in pairs(tools) do if tool.Name == "MakeItRain" then door1.Transparency = .2 door1.CanCollide = true end end end script.Parent.ClickDetector.MouseClick:connect(onClicked)