Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

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

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.

1 comment

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.

1 answer

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.

1 comment

0

Yup my bad it's a remotefunction

This discussion is preserved as it was. New answers, comments, and votes are closed.