Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

Can I make a group rank to game script?

What I am trying to do is connect one of my SCPF groups with the game I am currently making, so basically, Level-1 will get "[SCP] Card-L1", Level-2 will get "[SCP] Card-L2" etc.

I have been trying scripts from everywhere, please help...

1 answer

We can build a table to map rank names (otherwise known as roles) to titles, and look up the player's role in it:

local GroupId = 1
local Prefix = "[SCP]"
local GroupRoleToTitle = {
	["Level-1"] = "Card-L1",
	["Level-900"] = "Really High Level Person With a Lot of Authority"
}

local function OnPlayerAdded(Player)
	local Role = Player:GetRoleInGroup(GroupId)
	local Title = GroupRoleToTitle[Role]

	print(Title) --> The title!
end

local Players = game.Players:GetPlayers()

for Index = 1, #Players do
	-- Just in case players join before the event is connected in Studio!
	local Player = Players[Index]

	OnPlayerAdded(Player)
end

game.Players.PlayerAdded:Connect(OnPlayerAdded)

This discussion is preserved as it was. New answers, comments, and votes are closed.