Mousebutton1 with controls script and click detectors problem

Hello! So I came across an issue with a script that sometimes listens for Mousebutton1 which up until now has been great. However I need the player to be able to use parts with ClickDetectors in them. Which when I click on those, the script waiting for Mousebutton1 fires as well. Is there a way around this or something I should be doing better? Thanks in advance.

Edit: Basically one script waits for mousebutton1click to use an attack, which also activates every time the player uses clickdetectors.

Not sure exactly what you’re trying to get through but I would suggest only using MouseButton1Down or MouseButton1Click because exploiters can fire ClickDetectors from anywhere in the game.

Just set the code that runs when MouseButton1Click fires into a function , place it in a module and access the function and run it both in the script where MouseClick is detected for a Click Detector and where MouseButton1Click is detected for UI, this way you won’t be using a lot of code and you could run the same function 2 places.

This would cause a set function to run when both events fire as you’ll have called the function to run in both scripts.

Or am I misunderstanding your question?

Maybe just a little, basically I have a script that waits for the mousebutton1click so to use an attack, but it also fires when I use click detectors, but I might just have to avoid using clickdetectors for now and just use ui elements instead.