Hi, I asked a question earlier through wondering why my script isn't working that's getting fired from a Remote Function that accesses the mouse object through the Local Script, then transfers it to the script. But It doesn't work, It just says it's nil. Does anyone know a way to avoid this, or would a Remote Event work instead? Thanks.
COMMUNITY QUESTION
Is there a way to access the mouse through a Remote Function?
2 answers
Nil mouse is intentional because it's simply bad networking practice. Try to simply send a dictionary of the mouse properties if you need them so bad.
{Hit=mouse.Hit,Target=mouse.Target,X=mouse.X,Y=mouse.Y}
Plus anything else you want of course
If you want to send the request from the player's mouse target to the server then you must make sure from the Local script that it is a real object, and not nil
Here's an example script:
if mouse.Target then
RemoteFunction:InvokeServer(mouse.Target)
end
--Or you could use this!
if mouse.Target ~= nil then
RemoteFunction:InvokeServer(mouse.Target)
end
This discussion is preserved as it was. New answers, comments, and votes are closed.

3 comments
He's asking for an access through a RemoteFunction, not a RemoteEvent
???
magicguy, it makes literally no difference as either way you prefer will make no difference to the fact that the server has no access to the mouse itself.