How can I fix my leaderboard/nametag script?

I’m trying to create a script that creates a leaderboard that lists everybody’s rank and gives them an above-head nametag, with the same rank. However, for some reason, the script doesn’t work. Upon testing in-studio, the output shows no errors. The script itself also shows no errors.

I also added some print functions at several points within the script, and only 3 of the 6 have worked. In-studio, there were zero changes or errors prior to adding the prints.

local billboard = script.BillboardGui
			local RankAbrv = "Rank Loading"
       			local GR = Player:GetRankInGroup(5290077)
       				if GR == 15 then RankAbrv = "Pending"
      			    elseif GR == 45 then RankAbrv = "SUSPICOUS"
        			elseif GR == 75 then RankAbrv = "Polar"
        			elseif GR == 90 then RankAbrv = "Ardent"
        			elseif GR == 105 then RankAbrv = "Team"
        			elseif GR == 120 then RankAbrv = "Kinetic"
        			elseif GR == 135 then RankAbrv = "Advancement"
        			elseif GR == 150 then RankAbrv = "Order"
        			elseif GR == 165 then RankAbrv = "Developer"
        			elseif GR == 180 then RankAbrv = "Ally"
        			elseif GR == 195 then RankAbrv = "International"
        			elseif GR == 210 then RankAbrv = "Blaze"
        			elseif GR == 225 then RankAbrv = "Morning"
	        		elseif GR == 250 then RankAbrv = "Council"
       				elseif GR == 252 then RankAbrv = "Commander"
       				elseif GR == 255 then RankAbrv = "older"
        			elseif GR == 0 then RankAbrv = "Guest"
        			elseif == "AFuturisticFox" then RankAbrv = "Ally"
        			elseif == "MainDragon1971" then RankAbrv = "Ally"    

local Stats ="IntValue")
	Stats.Name = "leaderstats"
local Rank ="StringValue")
	Rank.Name = "Rank"
	Rank.Value = RankAbrv

    Rank.Parent = Stats

local CloneGUI = billboard:Clone()
local Usrnm = 
	CloneGUI.Parent = char.Head
    	CloneGUI.Rank.TextTransparency = 0
   		CloneGUI.Rank.Text = "["..RankAbrv.."]"
   		CloneGUI.Username.TextTransparency = 0
   		CloneGUI.Username.Text = Usrnm 


Of the six, only “Begin”, “End”, and “Mid1” printed.


Explorer Tree:

In-studio testing (Nothing appears):

Small Fixes

@Minstrix mentioned adding an end to my elseifs. While this did allow all of my print functions to work, and assign an above-head nametag, it still hasn’t set the leaderboard, oddly enough.

I’ve been struggling to solve this for a while, thanks!

1 Like

Just from quickly glancing over it, I believe that you’re missing an end after the big if elseif chain.

1 Like

That slightly solved the problem, thanks!

Now, all prints printed, and it gave me an above-head nametag. However, the leaderboard didn’t load…

1 Like

it might be me but your leaderstats are an intvalue instead of a folder?

local Stats ="IntValue")
	Stats.Name = "leaderstats"

I changed it to an IntValue while trying to ix it, however, changing it back to a leaderstats folder didn’t change anything. But good catch! Thanks!

local function onPlayerJoin(player)
	local leaderstats ="Folder")
	leaderstats.Name = "leaderstats"
	leaderstats.Parent = player

Aditionally you should make your elseifs into ranges If it’s greater than or equal to 45 and less than or equal to 49. If they are GR 47, they still have a rank in their leaderstats.

1 Like

Ah, after looking at @Steve_Speedy’s post, just remembered you have to parent it to the player for it to appear as well.

And yes, I think it has to be a folder


Thanks! I forgot to use onPlayerJoin.

1 Like