Variable not being the value intended?

Currently making an grab and release characters when downed system for my game
However, the Variable value is actually my player instead of the intended, which is the character being carried.

these are shortened versions of my codes, Server-side and Client-side
Client:

game:GetService("RunService").RenderStepped:Connect(function()
	MouseHit = mouse.Target
	if MouseHit:FindFirstAncestorWhichIsA("Model") and MouseHit:FindFirstAncestorWhichIsA("Model"):FindFirstChild("CanBeRevived") then
		IsPlayer = true
		G = MouseHit:FindFirstAncestorWhichIsA("Model"):FindFirstChild("CanBeRevived")
	else
		IsPlayer = false
		G = nil
	end
end)
game:GetService("UserInputService").InputBegan:Connect(function(input)
	if IsPlayer == true and G ~= nil and G.Value == true and script.Parent.Parent.Carrying.Value == false then
		if input.KeyCode == Enum.KeyCode.F then
			C = mouse.Target:FindFirstAncestorWhichIsA("Model")
			print("grab")
			script.Parent.GrabREvent:FireServer(C)
		end
end)

For some context:
IsPlayer is a bool value which detects if mouse.target is a player every frame and G is the Down detector value of the character being carried

Server:

script.Parent.GrabREvent.OnServerEvent:Connect(function(C)
print(C)
end)

print result is my player name, and not the character which is being carried

OnServerEvent’s first paramter is the player that the event was fired from. So just fix it by doing this script.Parent.GrabREvent.OnServerEvent:Connect(function(player, C)

1 Like

Oh, It is working now, thank you!

just a question, do I need to send the player also when im firing the Remote event to the server?

No the player is already passed through