Script that makes nametag pop up won't work

So the script was suppose to make a Nametag Visible and it doesn’t work…
[Note: The full script is huge and I just added another section to the nametag script]

if Player:GetRankInGroup(BETAtestersGroup) == 255 then
      game.Workspace.Nametag.Rank.BETAtesters.Visible = true
end

What is the error in this script?

You need to put the id of your group not the name of it.

Well it’s weird because I checked and there is no error…

Uh there is a local for it

local BETAtestersGroup = [GroupID]

I assume that you’re making it visible on the client. You must do it on server so people can serve the name tag.

Uh what do you mean by that???

I assume you’re still new to scripting and you don’t understand how this works. Check this article out.

Are you doing this in a local script or server script? I don’t think it matters anyways, both local and server can call the function. Have you tried debugging your code, e.g adding in prints? Where is the name tag located?

It’s on a server script and it has no errors.

This is not necessarily needed as it’s a server script already.
Since we are dealing with nametags that everyone can see, it can be controlled perfectly fine from the server.

Assuming that “BETAtestersGroup” is a variable holding a number, make sure it’s the correct group Id.

Well, the only reason I can think of is that the function isn’t accurate on the server, as stated in the API reference.

Using this in a Script , as opposed to a LocalScript , will not get you the most up-to-date information. If a player leaves a group while they are in the game, GetRankInGroup will still think they’re in that group until they leave. However, this does not happen when used with a LocalScript.

Can you try adding a print after the conditional check? and see if it prints?

To be honest the error might be here. Reason being is you are just making the nametag in workspace visible

You really should be cloning the nametag to the player if they are in the group, then making that nametag visible

player.CharacterAdded:Connect(function(character)
   if player:GetRankInGroup(groupId) == 255 then
      local head = character:WaitForChild("Head")
      local tag = game.Workspace.Nametag:Clone()
      tag.Parent = head
      tag.Visible = true
   end
end)

Is this supposed to be in the player’s head? Or is nametag a thing in Workspace?

Why is the nametag in workspace place it inside of startergui or something.

game.Players.PlayerAdded:Connect(function(Player)
Player.CharacterAdded:Connect(function(Char)
Char:WaitForChild(“Humanoid”).DisplayDistanceType = “None”
local Tag = script.Rank:Clone()
local TeamColor = Player.TeamColor
Tag.Parent = Char.Head
Tag.Adornee = Char.Head

[This is the start of the script]

Ok! So I would replace that line with:

Tag.Enabled = true

/

Tag.Rank.Visible = true

For reasons stated above :wink:

I was adding a 4th Line to it so I had to make it visible for me to edit, it’s usually in ServerScriptStorage.