Hey so im trying to do things with remotefunctions,
Im trying to make it so the server side will fire a remotefunction and the remotefunction which is on the client side will return a players mouse lookvector, However it isn’t working very well for me and I have no idea what the issue is because it just says argument 1 missing or nil
BV = Body Velocity
(Also if it wasn’t clear this is my first time messing with remotefunctions so I got no idea what I’m doing)
–Client
tool.RemoteFunction.OnClientInvoke = function(velocity)
local Speed2 = game.Players.LocalPlayer:GetMouse().Hit.LookVector
return Speed2
end
—Server
local NewSpeed = tool.RemoteFunction:InvokeClient(Velocity)
print(NewSpeed)
Velocity = NewSpeed*113
return Velocity
end
You need to pass a player instance as the first argument to InvokeClient() in order to specify which client to invoke.
This is similar to how FireClient() of a RemoteEvent instance also requires its first argument to be a player instance indicating which client to fire.