Remote Event never receiving

Hello everyone! So I am trying to fire a remote event to show a killed player GUI, however when I try to fire it, I get the error: FireClient() must have a player object in it. I know I have a player object, and I don’t know how to fix it. Code below:

function handleKillCount(humanoid, player)
	local killer = getKillerOfHumanoidIfStillInGame(humanoid)
	if killer ~= nil then
		local stats = killer:findFirstChild("leaderstats")
		if stats ~= nil then
			local kills = stats:findFirstChild("Coins")
			if killer ~= player then
				kills.Value = kills.Value + 50
				
				local p = game.Players:FindFirstChild(killer)
				
				game.ReplicatedStorage.Events.KillGui:FireClient(p, killer)

			else
				kills.Value = kills.Value - 1

			end
		end
	end
end

I’m not sure what you aimed for here? I’m assuming the variable “killer” is the killer player, not a string. :FindFirstChild() only works with strings.

Let me show you a different function call. You’ll notice that killer is returned as a value, not a player object.

function getKillerOfHumanoidIfStillInGame(humanoid)
	-- returns the player object that killed this humanoid
	-- returns nil if the killer is no longer in the game

	-- check for kill tag on humanoid - may be more than one - todo: deal with this
	local tag = humanoid:findFirstChild("creator")

	-- find player with name on tag
	if tag ~= nil then

		local killer = tag.Value
		if killer.Parent ~= nil then -- killer still in game						
			return killer
		end
	end

	return nil
end

Who are you trying to inform with the RemoteEvent? Killer or the victim?

The killer. I am trying to make a GUI alert them that they killed the player and got 50 coins (Already coded on the client side). My issue resides with that one error

function handleKillCount(humanoid, player)
	local killer = getKillerOfHumanoidIfStillInGame(humanoid)
	if killer ~= nil then
		local stats = killer:findFirstChild("leaderstats")
		if stats ~= nil then
			local kills = stats:findFirstChild("Coins")
			if killer ~= player then
				kills.Value = kills.Value + 50
				game.ReplicatedStorage.Events.KillGui:FireClient(killer)

			else
				kills.Value = kills.Value - 1

			end
		end
	end
end

We already have the killer player object defined so we can fire the event on them like this.

Thanks mate. I couldn’t really tell if it was a player or a value