I used this script for a leaderboard and put it in ServerScriptService but I can’t tell what’s wrong with it
game.Players.PlayerAdded:Connect(function(player)
local Leaderboard = Instance.new(“Folder”, player)
Leaderboard.Name = “Leaderboard”
local Deaths = Instance.new("NumberValue",Leaderboard)
Deaths.Name ="Deaths"
Deaths.Value = 0
local Deaths = Instance.new("NumberValue",Leaderboard)
Deaths.Name = "Deaths"
Deaths.Value = 0
player.CharacterAdded:Connect(function(character)
local humanoid = character:FindFirstChild("Humanoid")
humanoid.Died:Connect(function(died)
KO.Value= KO.Value + 1
local tag = humanoid:FindFirstChild("creator")
local killer = tag.Value
if tag and killer then
killer.Leaderboard:FindFirstChild("KO").Value= killer.Leaderboard:FindFirstChild("KO").Value+1
end
end)
end)
end)
1 Like
Use Leaderboard.Name = “leaderstats”
(all lowercase) I just edited it
The name of the folder is supposed to be leaderstats
if you’re using the default Roblox leaderboard system
Also why did you make 2 Death intvalues?
I dunno felt like the right thing
idk if not the right thing to do
I thnik you meant to make one of them for KO
, and also I think this
KO.Value= KO.Value + 1
Should be
Deaths.Value += 1
So it increments the Deaths by 1 for who died and
killer.Leaderboard:FindFirstChild("KO").Value= killer.Leaderboard:FindFirstChild("KO").Value+1
Should be
killer.leaderstats.KO.Value += 1
still ain’t working
game.Players.PlayerAdded:Connect(function(player)
local Leaderboard = Instance.new(“Folder”, player)
Leaderboard.Name = “leaderstats”
local Deaths = Instance.new("NumberValue",leaderstats)
Deaths.Name ="Deaths"
Deaths.Value = 0
local Deaths = Instance.new("NumberValue",leaderstats)
Deaths.Name = "Deaths"
Deaths.Value = 0
player.CharacterAdded:Connect(function(character)
local humanoid = character:FindFirstChild("Humanoid")
humanoid.Died:Connect(function(died)
KO.Value= KO.Value + 1
local tag = humanoid:FindFirstChild("creator")
local killer = tag.Value
if tag and killer then
killer.Leaderboard:FindFirstChild("KO").Value+ 1 killer.leaderstats.KO.Value += 1
end
end)
end)
end)
the text right above is part of the code
You forgot to implement what I had said or had done it incorrectly, try this
game.Players.PlayerAdded:Connect(function(player)
local leaderstats = Instance.new("Folder")
leaderstats.Name = "leaderstats"
leaderstats.Parent = player
local KO = Instance.new("IntValue")
KO.Name = "KO"
KO.Value = 0
KO.Parent = leaderstats
local Deaths = Instance.new("IntValue")
Deaths.Name = "Deaths"
Deaths.Value = 0
Deaths.Parent = leaderstats
player.CharacterAdded:Connect(function(character)
local humanoid = character:WaitForChild("Humanoid")
humanoid.Died:Connect(function(died)
Deaths.Value += 1
local tag = humanoid:FindFirstChild("creator")
local killer = tag and tag.Value
if killer then
killer.leaderstats.KO.Value += 1
end
end)
end)
end)
thanks! this is just what i needed!
1 Like
Anytime! If you have anymore issues don’t be afraid to make another post!
1 Like