Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

I made this script to make a rank leaderboard, can someone tell me why it doesn't work?

I need help with this script that is suppose to show ranks on a leaderboard. Can anyone tell me what's wrong with it?

game.Players.PlayerAdded:connect(function(P)
	repeat wait(1) until P:findFirstChild("leaderstats")
	local Rank = Instance.new("StringValue", P.leaderstats)
		Rank.Name = "Rank"
		Rank.Value = P:GetRoleInGroup(3015629)	
end)

2 comments

0

Any errors?

0

There is an object named leaderstats that gets added to the player, correct?

1 answer

I think you have to add the leaderstats object yourself.

game.Players.PlayerAdded:connect(function(P)
    local leaderstats = Instance.new("Model", P) -- Create the leaderstats object
    leaderstats.Name = "leaderstats"
    local Rank = Instance.new("StringValue", leaderstats)
        Rank.Name = "Rank"
        Rank.Value = P:GetRoleInGroup(3015629)  
end)

This discussion is preserved as it was. New answers, comments, and votes are closed.