#can someone help me get role id from group?
3 messages · Page 1 of 1 (latest)
My legacy open source rank checker module
MainData = {}
MainData["RankChecker"] = {
GroupId = 34481375, -- Replace with your group ID
-- Define rank IDs and names
RankNames = {
[255] = "Owner",
[253] = "Developer",
[252] = "Community Manager",
[251] = "Admin",
[250] = "Moderator",
[4] = "Content Creator",
[3] = "Donator"
},
-- Define colors for each rank
RankColors = {
["Owner"] = Color3.fromRGB(255, 0, 0), -- Neon Red
["Developer"] = Color3.fromRGB(255, 165, 0), --orange
["Community Manager"] = Color3.fromRGB(0, 255, 247), -- cyan blue
["Admin"] = Color3.fromRGB(0, 0, 255), -- Neon blue
["Moderator"] = Color3.fromRGB(128, 0, 128), -- dark purple
["Content Creator"] = Color3.fromRGB(85, 0, 0), -- dark red
["Donator"] = Color3.fromRGB(255, 255, 0) -- Neon yellow
},
-- Function to get the rank name by rank ID
GetRankName = function(self, rankId)
return self.RankNames[rankId]
end,
-- Function to get the player's rank in the group
GetPlayerRank = function(self, player)
local success, rankId = pcall(function()
return player:GetRankInGroup(self.GroupId)
end)
if success then
return rankId
else
warn("Failed to get rank for " .. player.Name .. ": " .. rankId)
return nil
end
end,
-- Function to get the color for a rank name
GetRankColor = function(self, rankName)
return self.RankColors[rankName] or Color3.fromRGB(255, 255, 255) -- Default to white if no color is found
end,
-- Function to check and print ranks of all players in the game
CheckAndPrintRanks = function(self)
for _, player in ipairs(game.Players:GetPlayers()) do
local rankId = self:GetPlayerRank(player)
if rankId then
local rankName = self:GetRankName(rankId)
local rankColor = self:GetRankColor(rankName)
print(player.Name .. " has rank ID " .. rankId .. " (" .. rankName .. ") with color " .. tostring(rankColor))
end
end
end
}
Uhh