How To Make a Kills And Deaths Leaderstat! (Roblox Studio Tutorial)
In todays video, I teach you how to make a kills and deaths learderstat for your Roblox game. enjoy! (:
here is the 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)
---------------------------------------------------
Other Videos By ScriptMaster
Other Statistics
Roblox Statistics For ScriptMaster
Currently, ScriptMaster has 21,386 views for Roblox across 46 videos. Less than an hour worth of Roblox videos were uploaded to his channel, roughly 7.06% of the content that ScriptMaster has uploaded to YouTube.