How can I get both the hit and the local player?
function RemoteFunction.OnServerInvoke(hit)
Sorry I didn't explain myself correctly, I meant I need to get the local player (myself) and the hit and normally I would do:
function RemoteFunction.OnServerInvoke(player)
but since I need also:
function RemoteFunction.OnServerInvoke(hit)
I do not know how to get both of them at once.
There is actually a function in rblx lua that does presicley what you want called GetPlayerFromCharacter()
function RemoteFunction.OnServerInvoke(hit) if hit.Parent:FindFirstChild("Humanoid") then local player = game.Players:GetPlayerFromCharacter(hit.Parent)--gets the player from the model in workspace end end
for more on GetPlayerFromCharacter go to: http://wiki.roblox.com/index.php?title=API:Class/Players/GetPlayerFromCharacter