FireClient: player argument must be a Player object

Thrive.Touched:Connect(function(hit)
	
	local player = hit.Parent
	local Humanoid = player:FindFirstChild("Humanoid")
	if Humanoid and Humanoid.Health ~= 0 then
		
		ThriveJumpEvent:FireClient(hit) -- Error Here (i've tried putting "player" in place of the "hit"
		Humanoid.Health = 0
		
	end
	
end)

The output keeps saying: FireClient: player argument must be a Player object which I know what it means, but I don’t know what to do.

Any help is appreciated!

Yeah, You arent getting the Player at all, you are basically telling the code t get the Parent of the Object that hit the Part, if its the Character, their Class is a Model, not a Player, in order to convert this into a Player, you should use game.Players:GetPlayerFromCharacter() which would get the Player instance based of the Item given, it the Player is not found with the specified Instance, it will return nil, so you would check to check if there is a Player:

local character = hit.Parent
local Humanoid = character:FindFirstChild("Humanoid")
local player = game.Players:GetPlayerFromCharacter(character) -- gets player off of character
if Humanoid then -- if there is a humanoid
    if player then -- if there is a Player
        ThriveJumpEvent:FireClient(player)
        Humanoid.Health = 0
    end
end
1 Like

You can use GetPlayerFromCharacter for this

local player = game.Players:GetPlayerFromCharacter(Humanoid.Parent)

if player then
    ThriveJumpEvent:FireClient(player)
end
1 Like

xft2008, elaborate with what you’re trying to do first

This worked perfectly, thank you!

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.