Leaderboard Rank

Put in ServerScriptService

by PunyAdmin1

Author Avatar
local playerStats = {} --this keeps a list of the stats for each player that enters the game

 game.Players.PlayerAdded:connect(function(player)
     local leaderstats = Instance.new("Model", player)
     leaderstats.Name = "leaderstats"

     local grouprank = Instance.new("StringValue", leaderstats)
     grouprank.Name = "Rank"
     local rank = player:GetRoleInGroup(4480202) -- Insert the group ID for whatever group you want ranks displayed for here. 

     if rank ~= 0 then -- Sets the rank that isnt in your group (Keep it 0)
         grouprank.Value = rank
      else
         grouprank.Value = "Guest" --  Names the rank of people not in your group (Ex: Guest)
     end

     playerStats[player] = leaderstats 
 end)

View in-game to comment, award, and more!