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

This remotefunction that passes the mouse to the server works in studio, but not online?

Asked by
drew1017 330 Moderation Voter
9 years ago

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.

0
Wait? Is it a RemoteEvent, or a RemoteFunction? Because how you are going about it, these callbacks and functions are only available to RemoteFunctions. M39a9am3R 3210 — 9y

1 answer

Log in to vote
0
Answered by
1waffle1 2908 Trusted Badge of Merit Moderation Voter Community Moderator
9 years ago

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.

0
Yup my bad it's a remotefunction drew1017 330 — 9y
Ad

Answer this question