Problem with nametag

Hi it’s been 3 hours since i have tried many things to fix this code but anything i do it doesn’t seem to be working
code:

local STag = script.Species
local NTag = script.NameRank

game.Players.PlayerAdded:Connect(function(plr)
	plr.CharacterAdded:Connect(function(char)
		local Head = char.Head
		local SpeciesTag = STag:Clone()
		local NameTag = NTag:Clone()
		NameTag.Parent = Head
		SpeciesTag.Parent = Head
		SpeciesTag.TextLabel.Text = "Custom | Mortal"
		NameTag.TextLabel.Text = plr.Name.." | "..plr:GetRoleInGroup(16721078)
		if plr:GetRankInGroup(16721078) == 254 or plr:GetRankInGroup(16721078) == 253  then
			NameTag.TextLabel.UIGradient.Enabled = true
		end
	end)
end)

It only works on me when i join but no one else and when i test it with 2 players in studio it works there

1 Like

Is this being done on a LocalScript or a server script?

server script i have done it before idk why this time its not working on all players

From the information given, it appears that the code has a problem in that it only functions for the player who controls the server on which the game is being played, but not for new participants.

This might be the result of the script only being run on the client side of the server owner and not on the client side of any new participants. You must make sure that the script is distributed to every player who joins the game in order to correct this.

To interact between the server and the clients in this manner, use a RemoteEvent or RemoteFunction. In the server script, you can build a RemoteEvent or RemoteFunction.

2 Likes

If no errors are being thrown in the output, it may be that you don’t provide any “else” statement after the following line:

My guess is, the script knows what to do for you, since your rank is one of the two options, but other ranks it has no indication of how to handle them.

1 Like

Sadly it didn’t work either it just gives it to me but not for other players and it worked in studio? why didn’t it work in game

1 Like

Probably not cause i did it the same way previously had no problems

Well I read other dev forums questions about this same problem and i found out that it should be placed inside the humanoidrootpart instead of head and i should just fix the studsoffset so yeah i did that and it worked

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.