I don’t know if I should’ve posted this here, or in Scripting Support. Regardless, I’d like some tips for improving my above-head name tag UI code. While this does work, if multiple people spawn or join at the same time, the code can assign people the same rank.
.rbxl File
CodeReview.rbxl (20.7 KB)
Code + Hierarchy
Code
local billboard = script.BillboardGui
game.Players.PlayerAdded:Connect(function(Player)
Player.CharacterAdded:Connect(function(char)
local GR = Player:GetRankInGroup(5290077)
if GR == 15 then RankAbrv = "PENDING"
elseif GR == 30 then Player:kick ("You are suspended.")
elseif GR == 45 then RankAbrv = "SUSPICOUS"
elseif GR == 60 then Player:ban ("Exploiter noob")
elseif GR == 75 then RankAbrv = "PLR"
elseif GR == 90 then RankAbrv = "ADNT"
elseif GR == 105 then RankAbrv = "TM"
elseif GR == 120 then RankAbrv = "KNTC"
elseif GR == 135 then RankAbrv = "ADV"
elseif GR == 150 then RankAbrv = "ODR"
elseif GR == 165 then RankAbrv = "DEV"
elseif GR == 180 then RankAbrv = "ALLY"
elseif GR == 195 then RankAbrv = "INTL"
elseif GR == 210 then RankAbrv = "BLZ"
elseif GR == 225 then RankAbrv = "MRN"
elseif GR == 240 then Player:ban ("Exploiter noob")
elseif GR == 250 then RankAbrv = "CNCL"
elseif GR == 252 then RankAbrv = "CMDR"
elseif GR == 255 then RankAbrv = "HDR"
elseif GR == 0 then RankAbrv = "GUEST"
elseif Player.name == "AFuturisticFox" then RankAbrv = "ALLY"
elseif Player.name == "MainDragon1971" then RankAbrv = "ALLY"
end
wait(0.1)
print(RankAbrv)
local newgui = billboard:Clone()
local Usrnm = Player.name
newgui.Parent = char.Head
newgui.TextLabel.TextTransparency = 0
newgui.TextLabel.Text = "["..RankAbrv.."]".." "..Usrnm
end)
end)
Hierarchy
I recently made a topic about a rainbow nametag maker. I tried applying the same concepts I learned from that, but I never figured out how to apply it.
Thanks!