In this 1 minute Roblox Studio tutorial i will be showing you how to add leaderboard for when you die and when you get a kill in Roblox Studio with a script you can copy!
Script
------------------------------
local Players = game.Players
local Template = Instance.new 'BoolValue'
Template.Name = 'leaderstats'
Instance.new('IntValue', Template).Name = "Kills"
Instance.new('IntValue', Template).Name = "Deaths"
Players.PlayerAdded:Connect(function(Player)
wait(1)
local Stats = Template:Clone()
Stats.Parent = Player
local Deaths = Stats.Deaths
Player.CharacterAdded:connect(function(Character)
Deaths.Value = Deaths.Value + 1
local Humanoid = Character:FindFirstChild "Humanoid"
if Humanoid then
Humanoid.Died:connect(function()
for i, Child in pairs(Humanoid:GetChildren()) do
if Child:IsA('ObjectValue') and Child.Value and Child.Value:IsA('Player') then
local Killer = Child.Value
if Killer:FindFirstChild 'leaderstats' and Killer.leaderstats:FindFirstChild "Kills" then
local Kills = Killer.leaderstats.Kills
Kills.Value = Kills.Value + 1
end
return
end
end
end)
end
end)
end)
----------
sick of watching 30 minute tutorials? you found the right place suggest future videos in the comment section! i do Roblox studio tutorials and try to make them as short and simple as possible for new people and i hope you enjoy them.
![](https://s2.save4k.ru/pic/jAzV72kWqN8/maxresdefault.jpg)