Error with getting player

Hello, the lost people,

I need help with getting a player from the local function. I tried a different way to fix it but still didn’t work. Please help me.

Code
local function attack(part)
	if game.Players:FindFirstChild(part.Parent.Name) then
		local player = game.Players:FindFirstChild(part.Parent.Name)
		if attacking == false then
			
			attacking = true
			local calledPlayer = game:GetService("Players"):GetPlayerFromCharacter(part.Parent)
			if calledPlayer then
				events:WaitForChild("playerDeath"):FireClient(killer, calledPlayer)
			end
			
		end
	end
end
Output

image

When you do :FireClient(), you are firing that RemoteEvent to a specific player. This is how you should do it:

events:WaitForChild("playerDeath"):FireClient(ThePlayer, killer, calledPlayer)

Well, thats work. Tysm for heping me LOL. I’m so stupid

1 Like

It’s alright, you’re not stupid you’re learning haha.