Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Why is my leaderboard script not making a leaderboard when I test it in a local server?

Asked by 5 years ago

I'm currently learning scripting from Peasfactory's youtube channel. I'm currently working on making my first leaderboard and using the script I made below.

game.Players.PlayerAdded:Connect(function(player) local leaderstats = Instance.new("IntValue", player) stats.Name = "Leaderstats"

local points = Instance.new("IntValue", leaderstats)
points.Name = "Points"
points.Value = 0

end)

For some reason everytime I tried testing it the leaderboard does not show up. I am testing this in a local 1 player server and not in a solo server. I have also tried it with multiple players and the leaderboard still does not show up. I have even gone to other youtube channels who suggested I change the "local leaderstats" from an "intvalue" to "folders", "models", etc. Those did not work either. I am suspecting that "Filtering Enabled is the main culprit here but I am very unsure of this as I am still just a beginner. Any feedback and help would be greatly appreciated. Thank you for taking the time to help address my issue.

0
The l in Leaderstats needs to be lowercase. Just change it to "leaderstats" User#21908 42 — 5y
0
Also the points parent needs to be stats. User#21908 42 — 5y
0
not leaderstats leaderstats may be the name but the variable that we are working with is stats. So use points.Parent = stats User#21908 42 — 5y

1 answer

Log in to vote
0
Answered by
popeeyy 493 Moderation Voter
5 years ago

You have some errors in your code. First of all, you tried to name "stats", which doesn't exist. Also, leaderstats should be a lowercase l not uppercase.

Here's the script that worked for me.

game.Players.PlayerAdded:Connect(function(player)
    local leaderstats = Instance.new("IntValue", player) 
    local points = Instance.new("IntValue", leaderstats)    
    leaderstats.Name = "leaderstats"
    points.Name = "Points"  
    points.Value = 0
end)
Ad

Answer this question