local Players = game:GetService("Players")
-- Tables to track scores
local vipScores = {} -- [UserId] = score
local regularScores = {} -- [UserId] = score
-- Example function to add score
function AddScore(player, score)
if player:GetRankInGroup(1234567) > 0 or player:HasPass("OlympicVIPPass") then
-- Assume player has VIP pass (replace with your VIP check)
vipScores[player.UserId] = (vipScores[player.UserId] or 0) + score
else
regularScores[player.UserId] = (regularScores[player.UserId] or 0) + score
end
end
-- Function to get top N players from a score table
local function GetTopPlayers(scoreTable, topN)
local scoreList = {}
for userId, score in pairs(scoreTable) do
table.insert(scoreList, {UserId = userId, Score = score})
end
table.sort(scoreList, function(a, b) return a.Score > b.Score end)
local topPlayers = {}
for i = 1, math.min(topN, #scoreList) do
table.insert(topPlayers, scoreList[i])
end
return topPlayers
end
-- Function to display or send leaderboard data to clients
function ShowLeaderboards()
local topVIP = GetTopPlayers(vipScores, 10)
local topRegular = GetTopPlayers(regularScores, 10)
-- Send this data to clients to display UI or print in chat
-- Example: RemoteEvent:FireAllClients(topVIP, topRegular)
end
-- Call ShowLeaderboards() at event end or regularly during event
