If so, how would you do it?
Script objects inside of Tool or Hopperbins can use the Equipped and Selected (respectively) events and get access to Mouse objects.
However, this isn't an elegant way to do it, nor do I believe it's a "true" solution because of how I believe it to be implemented from a technical perspective.
There is no direct way to get a mouse object on a server script in normal conditions.
The best you can do is use a LocalScript to repeatedly broadcast the information from the LocalPlayer's Mouse (obtained via GetMouse
).
The .Target
, .X
, .Y
, and .Hit.p
are the relevant fields that could be used. Since the mouse is only meaningfully read-only, this isn't so bad of a set-up (since both the LocalScript and ServerScript remain pretty simple)
A LocalScript is required to get a player's mouse. It's impossible to get it through a server script.
Try this : (In your server script)(Workspace)
for i,v in pairs(game.Players:GetPlayers()) do pcall(function() v:GetMouse() -- v,Is the Player (This gets the Player's Mouse from a server script) end) end
Tell me if it didnt work,Ill try helping out again.