Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How to find the players mouse from a server script?

I have made a script where you click a GUI and a RemoteEvent is fired to insert a model into the game and I'm trying to find the players mouse so that it is attached to the mouse. The trouble is how I can go about doing this.

How would I go about finding the players mouse since I don't believe local Mouse = Player:GetMouse() works in server scripts.

3 comments

0

u simply cant

0

the mouse object does not replicate to the server

1

You can fire the Mouse Position through the arguments in the local script to the server

1 answer

✓ Accepted answer

You don't.

Server model time

Thing is, Roblox stopped things like the player's mouse from replicating to the server automatically a while ago when they introduced filtering. Good, perfect - Now everyone's scripts are broken. The solution? RemoteEvents.

Thing is, you can just get the player's mouse locally and then keep telling the server the information you need from it, such as where it is pointing, or which parts it is touching.

But, we can do one better - We can just ignore the server entirely until everyone needs to know about the mouse. Placement scripts? Just say where you're placing it, and do all of the positioning locally. Server never has to know. Build tools? Same deal. Guns? Yep. The server is dumb. Keep it that way.

2 comments

0

Okay so if the server has used the insert service, how could I pass the inserted model onto the client? or would it be a better option to just insert the model AND THEN search for it locally?

0

RemoteEvent too

This discussion is preserved as it was. New answers, comments, and votes are closed.