Need Help With NameTag

Hello! I’m very new to scripting and I’m having some difficulties with my nametag (i know it’s silly). I’m trying to turn this old script from a gamepass requirement to a group rank requirement. I’ve tried different variations of the script but honestly just can’t figure it out. What I’m trying to make it to do is when somebody has a specific rank in the group, it gives them text over their head saying “HR”.

function passcheck(plr, what)
	if checkPass(plr, 0) then
		if what.Text == "" then
			what.Text = "" --The text that will appear over their head
		else
			what.Text = what.text..""
		end
	end

Thank you!

1 Like

@jacobthedragon4ever what information is send to the function ?
And you can use this for gamepass

For ReExecute the code when player spawn / respawn you ca use

in the PlayerAdded



    local id = 103728213 -- The GamePass ID Here
     
    game.Players.PlayerAdded:Connect(function(player) -- On Player Join the game
        if game:GetService("GamePassService"):PlayerHasPass(player, id) then  -- VErify if the player have gamepass
            print(player.Name .. " has the game pass!") -- Send Message if player has
        else
            print(player.Name .. " doesn't have the game pass...") --Send Message if player don't have
        end
    end)


Sorry if is not clear

What she wants is to to turn that old script from a gamepass requirement to a group rank requirement.

In conclusion, you have to use Player:GetRankInGroup() function to get the rank of the player and then check if it is on the rank that is needed.
then, use billboardgui to make an overhead gui

1 Like

Sorry if I didnt really explain it properly. I already have the gamepass nametag completed. I’m trying to convert this script into a script where if somebody has the required rank on the group, the nametag text will appear.

Yes, don’t worry the @BasedKnowledge post is your solution

Pretty sure I did this wrong, but is this what it should look like?

    if Player:GetRankInGroup(6154124) >= 255 then
		if what.Text == "" then
			what.Text = "HR"
		else
			what.Text = what.text..""
		end

Script

@jacobthedragon4ever why >= ??? you need for specific rank or for all group member, becose is is for group member is work but is not the best script

Just remember that IsInGroup > GetRankInGroup > GetRoleInGroup is cached on the server.
You can use GroupService to avoid this type of behavior.

From what I’m seeing, there shouldn’t be anything wrong with your script, and there isn’t much to see either, & I’m pretty sure you don’t need to check what the text is currently to change it.

Just remember that 255 is the highest rank possible in the group, so there wouldn’t be anything above it. You can just do == if you want the group owner to have the HR text.