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

Why won't this leaderboard work?

Asked by 10 years ago
1game.Players.PlayerAdded:connect(function(player)
2    local leaderstats = Instance.new("leaderstat",player)
3    leaderstats.Name = "leaderstats"
4 
5    local points = Instance.new('IntValue',leaderstats)
6    points.Name = "Points" --Name of stat
7    points.Value = "0"
8 
9end)

2 answers

Log in to vote
1
Answered by 10 years ago

There :)

01--Made by GuardainDev
02function Entered(player)
03    wait()
04 
05    if player:findFirstChild("leaderstats") ~= nil then
06        player.leaderstats:remove()
07    end
08 
09    stats = Instance.new("IntValue")
10    stats.Parent = player
11    stats.Name = "leaderstats"
12 
13    money = Instance.new("IntValue")
14    money.Parent = stats
15    money.Name = "Points"
View all 25 lines...
Ad
Log in to vote
0
Answered by 10 years ago

Try making leaderstats and points not local. Also, slightly change your code to this:

01--Make sure your script is a local script
02Player = game.Player.LocalPlayer
03game.Players.PlayerAdded:connect(function(player)
04    leaderstats = Instance.new("leaderstat",Player) --Player now has a variable set, so that should work
05    leaderstats.Name = "leaderstats"
06 
07    points = Instance.new('IntValue',leaderstats)
08    points.Name = "Points" --Name of stat
09    points.Value = "0"
10 
11end)

If it doesn't work let me know. I'm no leaderstats expert after all.

Answer this question