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

Leader board script not working correcly?

Asked by 7 years ago

I am making a leaderboard for a game which displays a players rank in a group, and displays the amount of cash a player has. But it does not work. Please fix it because i suck at scripting.

01game.Players.PlayerAdded:connect(function(player)
02local playerLeaderstats = {}
03local leaderstats = Instance.new("IntValue")
04leaderstats.Name = "leaderstats"
05leaderstats.Value = 0
06 
07local rank = Instance.new("StringValue")
08rank.Name = "Rank"
09rank.Value = player:GetRoleInGroup(3309505)
10 
11 
12leaderstats.Parent = player
13rank.Parent = leaderstats
14 
15game.Players.PlayerAdded:connect(function(player)
View all 36 lines...

1 answer

Log in to vote
2
Answered by 7 years ago
Edited 7 years ago

Here is a correctly version on your script, you have not need to put two "PlayerAdded" signal.

01local playerLeaderstats = {}
02 
03game.Players.PlayerAdded:connect(function(player)
04 
05    local leaderstats = Instance.new("Folder", player)
06    leaderstats.Name = "leaderstats"
07 
08    local rank = Instance.new("StringValue", leaderstats)
09    rank.Name = "Rank"
10    rank.Value = player:GetRoleInGroup(3309505)
11 
12    playerLeaderstats[player] = {}
13    playerLeaderstats[player]["Cash"] = 100
14 
15    local money = Instance.new("IntValue", leaderstats)
View all 26 lines...
Ad

Answer this question