Hey guys, I’m creating a gun script and i have a question.
How do i send Mouse.Hit.P over to the server?
I don’t know how to make the server receive that information,. Ive used RemoteEvents and they fire and everything i just cant receive that information. Thanks
I reckon that you can use a RemoteFunction to retrieve Mouse.Hit.P.
-- Client
RemoteFunction.OnClientInvoke = function()
return Mouse.Hit.P
end
-- Server
local hitPosition = RemoteFunction:InvokeClient(player)
However, I’d suggest invoking from client and let the server do the handling with rays and stuff. This will avoid the painful server lag(laggy cannons).
No please. A client can overwrite OnClientInvoke and permanently hang the server. RemoteEvents or sandboxing OnClientInvoke calls in pseudothreads are the only appropriate method here.
I forgot the example for the latter, I’ll get back to you if I find it.