First, you'll need to create a GUI to display the kills.
This script will update the GUI.
local killFeed = script.Parent -- The ScreenGui
local killFeedFrame = killFeed.Frame
local killFeedLabel = killFeedFrame.TextLabel
-- Services
local Players = game:GetService("Players")
-- Variables
local player = Players.LocalPlayer
local kills = {}
-- Function to add a kill to the feed
local function addKill(killer, victim)
table.insert(kills, 1, killer.Name .. " killed " .. victim.Name)
if #kills > 10 then -- Show last 10 kills
table.remove(kills, #kills)
end
killFeedLabel.Text = table.concat(kills, "\n")
end
-- Connection to listen for Humanoid.Died event
local function onHumanoidDied(humanoid)
local victim = humanoid.Parent
if victim:FindFirstChild("Humanoid") and victim ~= player.Character then
local killer = humanoid.Killer
if killer and killer:FindFirstChild("Humanoid") then
addKill(killer.Parent.Name, victim.Name)
else
addKill("Game", victim.Name)
end
end
end
-- Listening for character spawn to connect died event
player.CharacterAdded:Connect(function(character)
character:WaitForChild("Humanoid").Died:Connect(function() onHumanoidDied(character.Humanoid) end)
end)
-- Initialize with existing character if any
if player.Character then
player.Character:WaitForChild("Humanoid").Died:Connect(function() onHumanoidDied(player.Character.Humanoid) end)
end
Create fair combat with tools, hitboxes, and damage scripts fe roblox kill gui script full