All variables defined, thanks to Spongo for this function
Localscript:
remoteFunction.OnClientInvoke = function() return game.Players.LocalPlayer:GetMouse() end
Serverscript:
local mouse = remoteFunction:InvokeClient(player) print(mouse) --> nil
Ive tried a lot of things related to this but none of them have worked. I know it's possible because other filteringenabled games have done it, but I have no idea how to do it myself and nothing I try seems to work.
If REgetmouse
really is a RemoteEvent
then it does not have an OnClientInvoke
callback. Instead, you need to connect with the OnClientEvent
event.
That may just be an error in naming the object "REgetmouse" when it is actually a RemoteFunction, which would still let the script function when not online.
One reason I can think of why it doesn't work online is that you're trying to pass the client's mouse to the server, which is something I've never tried to do before and whatever you're trying to do it for probably does not need to be done that way and can be done a different way.
The reason that there is a difference between online and studio is that when you run a test simulation in studio, the server and client are still technically the same, where online they are not, so client-specific tasks (or objects) will still function as though they were still being controlled by the client.