Problem with my AFK system

Hi everyone, I have a problem with my AFK system: while testing everything, when a player goes AFK all the others in the server go AFK in the same way. I know it’s a problem with the Server Script but I really can’t fix it. A reference to what happens: https://gyazo.com/40fc9dbdf3b1760f891914cbb2bb5710
I’ve already tested it with two real players and the same happens.

Script (in ServerScriptService):

game.Players.PlayerAdded:Connect(function(player)
	player.CharacterAdded:Connect(function(character)
                remoteEv.OnServerEvent:Connect(function(plr, isAFK)
			if isAFK then
				plrTag.PlayerName.Text = "AFK | "..player.Name
			elseif not isAFK then
				plrTag.PlayerName.Text = player.Name
			end
		end)
         end)
end)

LocalScript (in StarterPlayerScripts):

local UserInputService = game:GetService("UserInputService")
local replicatedStorage = game:GetService("ReplicatedStorage")
local remoteEv = replicatedStorage.SistemiBase:WaitForChild("AFKSystem")

UserInputService.WindowFocusReleased:Connect(function()
	remoteEv:FireServer(true)
end)

UserInputService.WindowFocused:Connect(function()
	remoteEv:FireServer(false)
end)

The problem is your making a new onserverevent connection everytime a character is added which is not a good idea and you are referring to the player as “player” instead of “plr” if that makes sense. I would move the onserverevent out of any code block and go from there

Yeah about the plr that was my bad, didn’t notice that earlier. I’ll try to fix it.