How to get the mouse of the player holding tool

How do I get the mouse of the player holding the tool?

To get the player’s mouse use GetMouse

To get the player who’s holding the tool, you can do this

game.Players:GetPlayerFromCharacter(Tool.Parent)
1 Like

I knew how to do that, but I want the thing that happens to be server-sided when the player right clicks.

You’ll have to have a local script detect the right click and use a remote event to send a signal to a server script to do whatever you want it to do. You can’t listen for mouse input on the server.

How would I set it up with a remote event? I haven’t done much with remote events.

Here’s a tutorial on remote events. Remote events are used to send messages between local and server scripts (you can send messages both ways)

Ok, thank you, this is a great help!

1 Like