Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

How to find the players mouse from a server script?

Asked by
Memotag 226 Moderation Voter
5 years ago

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.

0
u simply cant theking48989987 2147 — 5y
0
the mouse object does not replicate to the server theking48989987 2147 — 5y
1
You can fire the Mouse Position through the arguments in the local script to the server Prestory 1395 — 5y

1 answer

Log in to vote
3
Answered by 5 years ago
Edited 5 years ago

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.

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? Memotag 226 — 5y
0
RemoteEvent too User#6546 35 — 5y
Ad

Answer this question