-
What I am trying to achieve right now is a four stat leader board that contains the following stats: Credits, Time, Kills, and Deaths.
-
The issue that I am having is that only two leaderstats appear when I am trying to have four, and plus whenever the player dies to NPC’s it doesn’t add a death.
-
I have tried combining scripts I even have two separate scripts however it only shows two instead of four.
(Keep in mind I am no scripter!)
game.Players.PlayerAdded:Connect(function(player)
local leaderstats = Instance.new(“Folder”, player)
leaderstats.Name = “leaderstats”
local money = Instance.new("IntValue", leaderstats)
money.Name = "Credits"
money.Value = 0
local time = Instance.new("IntValue", leaderstats)
time.Name = "Time"
time.Value = 0
while true do
wait(60)
time.Value = time.Value + 1
end
end)
game.Players.PlayerAdded:Connect(function(plr)
local stats = Instance.new("Folder")
stats.Name = "leaderstats"
stats.Parent = plr
local kills = Instance.new("IntValue")
kills.Name = "Kills"
kills.Parent = stats
local deaths = Instance.new("IntValue")
deaths.Name = "Deaths"
deaths.Parent = stats
plr.CharacterAdded:connect(function(char)
local humanoid
repeat
humanoid = char:FindFirstChild("Humanoid")
wait()
until humanoid
humanoid.Died:connect(function()
deaths.Value = deaths.Value + 1
local tag = humanoid:FindFirstChild("creator")
if tag then
local killer = tag.Value
if killer then
killer.leaderstats.Kills.Value = killer.leaderstats.Kills.Value + 1
end
end
end)
end)
end)