Script that is supposed to fire a function for a specific's team clients only, only fires for team's client that dies and not all the clients

ive been trying to make it so it fires for a specific team’s only clients but it only fires for the specific team’s client that dies.
please help me fix this annoying bug!
i got a script in startercharacterscripts that fires a remoteevent to the client and the localscript receives it and fires the remoteevent to the server and then the server checks if the player is on the specific team or not.
server script:

game:GetService("ReplicatedStorage").Events2.CombineDead.OnServerEvent:Connect(function(player)
	   if player.TeamColor == BrickColor.new("Black") then
		print("ok")
		local ok = screengui:Clone()
		ok.Parent = player.PlayerGui
		ok.Enabled = true
		ok.TextLabel.Text = "Officer "..player.Name.." is down."
		--ok.TextLabel.Position = UDim2.new(-5 + math.sin(tick())/13,0,-5 + math.sin(tick())/13,0)
		local function randomSound()

        local SoundList = game.ServerStorage.Combine.SoundList:GetChildren()  

        local randomNumber = math.random(1, #SoundList)
        for i, v in pairs(SoundList) do
        if i == randomNumber  then
        local sound = v:Clone()
        sound.Parent = ok
        sound:Play()

		wait(10)
					ok:Destroy()
				end
			end
	   end
			randomSound()	
	else                                         
		warn(player.Name.." is not a combine!!!")
	    end
end)

script in client:

script.Parent.Humanoid.Died:connect(function(player)
		    game:GetService("ReplicatedStorage").Events2.CombineDead:FireAllClients()
	end)

localscript in client:

    game:GetService("ReplicatedStorage").Events2.CombineDead.OnClientEvent:Connect(function(plr)
	game:GetService("ReplicatedStorage").Events2.CombineDead:FireServer()
end)

You cannot fireallclients from a localscript. If I were you, I would just iterate through the Players in the server script and check their team. If in the right team, the script will proceed to do whatever it is that you want it to do.

that is a script not a local script

also the remoteevent seems to only fire for one client and the server script already checks their team

here you are checking if the player’s team == “Black” and not if the player’s team is the same as the team of the player who died.
You should add a parameter or some way to check which team the player is in who died and compare it to that team.

game:GetService("ReplicatedStorage").Events2.CombineDead.OnServerEvent:Connect(function(player)
	   if player.TeamColor == BrickColor.new("Black") then
		print("ok")
		local ok = screengui:Clone()
		ok.Parent = player.PlayerGui
		ok.Enabled = true
		ok.TextLabel.Text = "Officer "..player.Name.." is down."
		--ok.TextLabel.Position = UDim2.new(-5 + math.sin(tick())/13,0,-5 + math.sin(tick())/13,0)
		local function randomSound()

        local SoundList = game.ServerStorage.Combine.SoundList:GetChildren()  

        local randomNumber = math.random(1, #SoundList)
        for i, v in pairs(SoundList) do
        if i == randomNumber  then
        local sound = v:Clone()
        sound.Parent = ok
        sound:Play()

		wait(10)
					ok:Destroy()
				end
			end
	   end
			randomSound()	
	else                                         
		warn(player.Name.." is not a combine!!!")
	    end
end)

that would result in:

game:GetService("ReplicatedStorage").Events2.CombineDead.OnServerEvent:Connect(function(player, playerWhoDied)
	   if player.TeamColor == playerWhoDied.TeamColor then
		print("ok")
		local ok = screengui:Clone()
		ok.Parent = player.PlayerGui
		ok.Enabled = true
		ok.TextLabel.Text = "Officer "..player.Name.." is down."
		--ok.TextLabel.Position = UDim2.new(-5 + math.sin(tick())/13,0,-5 + math.sin(tick())/13,0)
		local function randomSound()

        local SoundList = game.ServerStorage.Combine.SoundList:GetChildren()  

        local randomNumber = math.random(1, #SoundList)
        for i, v in pairs(SoundList) do
        if i == randomNumber  then
        local sound = v:Clone()
        sound.Parent = ok
        sound:Play()

		wait(10)
					ok:Destroy()
				end
			end
	   end
			randomSound()	
	else                                         
		warn(player.Name.." is not a combine!!!")
	    end
end)
script.Parent.Humanoid.Died:connect(function(player)
		    game:GetService("ReplicatedStorage").Events2.CombineDead:FireAllClients(player)
	end)
game:GetService("ReplicatedStorage").Events2.CombineDead.OnClientEvent:Connect(function(plr)
	game:GetService("ReplicatedStorage").Events2.CombineDead:FireServer(plr)
end)

I do not have time to check the code thoroughly so it may not work completely yet.

in the output it comes out nil

You mean this:

Is a normal script placed inside the player? If so, your script will break. Only localscripts can work inside the player, and be run on the client side.

Since the server handles everything, you shouldnt fire the client via the server to let the client fire the server, I recommend using a bindableEvent and fire another serverscript from the script which checks whether the player died or not

I would do the following:

script.Parent.Humanoid.Died:connect(function(player)
    --bindableEvent:Fire(player)
end)
bindableEvent.Event:Connect(function(playerWhoDied)
    --handle the check here
    for i, player in pairs(game.Players:GetPlayers()) do
        if player.TeamColor == playerWhoDied.TeamColor then
            --continue..
        end
    end
end)