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

Is there anything wrong with this Group Leaderboard?

Asked by 8 years ago
Edited 8 years ago

I made a custom leaderboard, yet it will not work, it says I have no errors, please help



game.Players.PlayerAdded:connect(function(plr) local stats =game.Players.LocalPlayer.Instance.new("IntValue", plr) stats.Name = 'leaderstats' stats.Value = 0 local Rank = game.Instance.new("StringValue", stats) Rank.name = 'NYP Rank' Rank.Value = plr:GetRoleInGroup(2841538) stats.Parent = plr Rank.Parent = stats end)

Thanks, and happy thanksgiving o3o -Rich

0
Fix your formatting. Put the ~ on a new line for it to work. TheDeadlyPanther 2460 — 8y
0
Sorry, mb, gg MrRichGuy0210 17 — 8y
0
Why is this a local script? User#5423 17 — 8y
0
It's not a local script. MrRichGuy0210 17 — 8y

1 answer

Log in to vote
1
Answered by 8 years ago
Edited 8 years ago

Here is some fixed code, with explanations:

game.Players.PlayerAdded:connect(function(p)
    local stats = Instance.new("Folder") -- Folder because it is better for organization
    stats.Parent = p
    stats.Name = "leaderstats" -- I missed this, but it is required to be named leaderstats for it to show up

    local rank = Instance.new("StringValue") -- Using the second parameter is less efficient
    rank.Parent = p
    rank.Name = "NYP Rank" -- Lua is case-sensitive
    rank.Value = p:GetRoleInGroup(2841538)

    -- There is no need to set the parents again
end)

Hope I helped!

~TDP

0
It still didn't work.. I think my game just sucks, xD MrRichGuy0210 17 — 8y
0
Ah, I missed one big thing. Let me edit. Remember in Lua, anything that doesn't work, doesn't work for a reason. TheDeadlyPanther 2460 — 8y
0
Nvm, I just rescripted it and I saw the error I made, gg, thanks! MrRichGuy0210 17 — 8y
Ad

Answer this question