Leaderboard not working!

So i made this script:

function leaderstats(player)
local stats = Instance.New(“Folder”)
stats.Name = “Leaderstats”
stats.Parent = player

local cash = Instance.new("IntValue")
cash.Name = "Coins"
cash.Value = 1000
cash.Parent = stats

end

And when i join

It dosent work
dontworl

1 Like

I have this same problem, I don’t know if it’s because the gui is now different.

3 Likes

It’s because you never actually ran the function.

You have to put a PlayerAdded event and connect it to the leaderstats() function.

function leaderstats(player)
    local stats = Instance.New(“Folder”)
    stats.Name = “leaderstats”
    stats.Parent = player

    local cash = Instance.new("IntValue")
    cash.Name = "Coins"
    cash.Value = 1000
    cash.Parent = stats
end

game.Players.PlayerAdded:Connect(leaderstats)

Your second mistake is that you have to name it leaderstats and it is case-sensitive so if you name it Leaderstat, it won’t work.

2 Likes

Thanks now it works! and i really forgot to run the function!

1 Like