User Input Service or Mouse

I have an event when the player clicks. Which one should I use mouse.Button1Down, or User input service.

I would suggest using either UserInputService or ContextActionService.

The developer website seems to be down right now, else I would give links on these two services.

Good luck!

1 Like

For some reason, when I use ContestActionService for a RightClick event it fires two times,

ContextActionService:BindAction("Onfire",OnFire,false,Enum.UserInputType.MouseButton2)

It fires for both the beginning of the click and its release. You can just check the input state, here’s another topic that shows how to do that:

4 Likes

Make sure you add a debounce to your script:

Example here:

Debounce = false
-- Your event here
if Debounce then return end
Debounce = true
delay(1,function() Debounce = false end))
1 Like