Hello,
So I feel a bit stupid on asking this but how can I create a leaderstat? I have done it before but for some reason it will not work when I am trying to do it. Once I tried doing it myself I turned to look at the article that roblox made and copied the exact code but it still will not work.
I am just confused now how to do it due to what I thought was right was exactly the same idea which Roblox put in there artical.
In-Game Leaderboards (roblox.com)
Here is a simple script for it:
game.Players.PlayerAdded:Connect(function(plr)
local leaderstats = Instance.new("Folder")
leaderstats.Name = "leaderstats"
leaderstats.Parent = plr
local Value = Instance.new("NumberValue")
Value.Name = "StatNameHere"
Value.Parent = leaderstats
end)
1 Like
That is how I would do it yes but when I do that it does not create one?
This is why I am sooo confused cuz it should be as simple as that but will not add it…
All and all, it’s really very simple. This script creates leaderstats for me:


game.Players.PlayerAdded:Connect(function(Player)
local Leaderstats = Instance.new("Folder")
Leaderstats.Name = "leaderstats"
Leaderstats.Parent = Player
local Cash = Instance.new("NumberValue")
Cash.Name = "Cash"
Cash.Parent = Leaderstats
end)
You see when I do something exactly like that it does not work.
Please send your script as a reply to this and I’ll check out the issue.
Here is my code:
game.Players.PlayerAdded:Connect(function(plr)
local Leaderstats = Instance.new("Folder")
Leaderstats.Parent = plr
Leaderstats.Name = "leaderstats"
local TixValue = Instance.new("NumberValue")
Leaderstats.Parent = Leaderstats
TixValue.Name = "Tix"
TixValue.Value = 0
end)
(this is in a script)
I am confused cuz it is like ur script and @AC_Starmarine one so dunno why it will not work.

You try to set the leaderstats parent to itself. Make sure this line says
TixValue.Parent = Leaderstats
Even when I change it there is no leaderstats created.
I made that mistake cuz I made the code quick to show u what I was doing.
game.Players.PlayerAdded:Connect(function(plr)
local Leaderstats = Instance.new("Folder")
Leaderstats.Parent = plr
Leaderstats.Name = "leaderstats"
local TixValue = Instance.new("NumberValue")
TixValue.Parent = Leaderstats
TixValue.Name = "Tix"
TixValue.Value = 0
end)

It works for me, so the likelihood is that you have another script somewhere already creating leaderstats, cancelling this one out and not making you able to see either.
I have fixed the issue now. Thanks for trying to help.
(the issue was that I was trying to create a leader stats inside a script which was in a tool and for some reason it was not allowing me to)
2 Likes