I have made a click detector and coded a script that will change the part's color when it is clicked but now I want to make it only turn that color when the player clicks on the brick with a certain tool.
clickDec = script.Parent.ClickDetector
part = script.Parent
clickDec.MouseClick:connect(function(player)
if player.Character.PartClicker and then
part.BrickColor = BrickColor.new("Really Red")
end
end)
The MouseClick event doesn't even get called when they are holding the tool and it shows I can click on the part when I'm not holding a tool but when I am it doesn't.
Does anyone know how to make it so the tool can execute an event when it clicks on the part?

1 comment
you can use Rays instead of click detectors