I made a custom leaderboard, yet it will not work, it says I have no errors, please help
01 | game.Players.PlayerAdded:connect( function (plr) |
02 |
03 | local stats = game.Players.LocalPlayer.Instance.new( "IntValue" , plr) |
04 |
05 | stats.Name = 'leaderstats' |
06 | stats.Value = 0 |
07 | local Rank = game.Instance.new( "StringValue" , stats) |
08 |
09 | Rank.name = 'NYP Rank' |
10 | Rank.Value = plr:GetRoleInGroup( 2841538 ) |
11 |
12 |
13 | stats.Parent = plr |
14 | Rank.Parent = stats |
15 |
16 | end ) |
Thanks, and happy thanksgiving o3o -Rich
Here is some fixed code, with explanations:
01 | game.Players.PlayerAdded:connect( function (p) |
02 | local stats = Instance.new( "Folder" ) -- Folder because it is better for organization |
03 | stats.Parent = p |
04 | stats.Name = "leaderstats" -- I missed this, but it is required to be named leaderstats for it to show up |
05 |
06 | local rank = Instance.new( "StringValue" ) -- Using the second parameter is less efficient |
07 | rank.Parent = p |
08 | rank.Name = "NYP Rank" -- Lua is case-sensitive |
09 | rank.Value = p:GetRoleInGroup( 2841538 ) |
10 |
11 | -- There is no need to set the parents again |
12 | end ) |
Hope I helped!
~TDP