Kill logger script only appearing on victim's screen

I have a script that logs players killed. It functions exactly like I want it to, besides one crucial detail.

I have a TextLabel that states who killed who, but it only pops up on the victim’s screen. The logging script works for the killer, but they won’t see anything until they die and get the kill message for them.

How can I make it so this shows on ALL players screens in the server? Thanks in advance.

local players = game:GetService("Players");
game:GetService("StarterGui").ResetPlayerGuiOnSpawn = false

players.PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function(character)
	local humanoid = character:WaitForChild("Humanoid");
	humanoid.Died:Connect(function()
		local tag = humanoid:FindFirstChildWhichIsA("ObjectValue")
		if tag.Name == "damagedBy" and tag.Value then
			player.PlayerGui.ScreenGui.KillUpdater.Text = (player.Name .. " was killed by " .. 
tag.Value.Name)
		end
	end);
 end);
end)

Use a RemoteEvent to fire all clients

Oh gotcha. So, for my RemoteEvent, would I fire it in this script above? Or in a separate script?

Try this. On second thought, I don’t think you need RemoteEvents

local players = game:GetService("Players");
game:GetService("StarterGui").ResetPlayerGuiOnSpawn = false

players.PlayerAdded:Connect(function(player)
    player.CharacterAdded:Connect(function(character)
	    local humanoid = character:WaitForChild("Humanoid");
	    humanoid.Died:Connect(function()
		    local tag = humanoid:FindFirstChildWhichIsA("ObjectValue")
		    if tag.Name == "damagedBy" and tag.Value then
			    for i,v in pairs(players:GetPlayers()) do
                    v.PlayerGui.ScreenGui.KillUpdater.Text = (player.Name .. " was killed by " .. tag.Value.Name)
                end
	      	end
	    end)
    end)
end)
1 Like