Group NameTag help

Hello!
I currently have a script that displays the name of the player, etc. I am unsure of how to make one of the tags update on a group role, though.
Current:
image

local gamePassID = 13992448  
	local MarketplaceService = game:GetService("MarketplaceService")
local function onPlayerAdded(character)
	local head = character:WaitForChild("Head")

	local old = script.NameDisplay:Clone()
	old.Parent = head
	local tag = head:WaitForChild("NameDisplay")
	local player = game:GetService("Players"):GetPlayerFromCharacter(character)
	local hasPass = false
	local increment = 1
	local head = character:WaitForChild("Head")
	local tag = head:WaitForChild("NameDisplay")

	-- Check if the player already owns the game pass
	local success, message = pcall(function()
		hasPass = MarketplaceService:UserOwnsGamePassAsync(player.UserId, gamePassID)
	end)

	-- If there's an error, issue a warning and exit the function
	if not success then
		warn("Error while checking if player has pass: " .. tostring(message))
		return
	end

	if hasPass then
		coroutine.wrap(function()
			while true do

				increment = 7
				wait (1)
				time += increment
				tag.PlayerName.Text = player.Name.."|"..time.."|".."Player".."X5 ACTIVE" -- set the time's text
			end
		end)()
	else
		coroutine.wrap(function()
			while true do
				wait (1)
				time += increment
				tag.PlayerName.Text = player.Name.."|"..time.."|".."Player" -- set the time's text
			end
		end)()
	end
end


onPlayerAdded(script.Parent) -- assuming it's parented to StarterCha

I want “Player” to display as a users rank in the group 5152485
Thanks!

You can just use the Player:GetRoleInGroup function and pass your groups ID.
The code could look something like this:

tag.PlayerName.Text = player.Name .. "|" .. time .. "|" .. Player:GetRoleInGroup(5152485)
1 Like

Fixed, thanks! i need more characters just to say thhanks whawt os this rocflfddbedthzsdt