There’s a seemingly simple nametag script that displays ones username and a rank in their group. It’s relatively simpliustic, but for some reason it just will not show up over my avatars head. Ideas?
game.Players.PlayerAdded:Connect(function(plyr)
plyr.CharacterAdded:Connect(function(char)
local rep = game.ReplicatedStorage
local nameTag = rep.Name
local rankTag = rep.Rank
print(nameTag)
local head = char.Head
local ntext = nameTag:Clone()
local nametext = nameTag.Txt
local rtext = rankTag:Clone()
local ranktext = rankTag.Txt
ntext.Parent = head
ntext.Adornee = head
nametext.Text = plyr.Name
rtext.Parent = head
rtext.Adornee = head
if plyr:IsInGroup(4808054)then
ranktext.Text = plyr:GetRankInGroup(4808054)
print(plyr:GetRankInGroup(4808054))
end
end)
end)
If this fires, it means it works as intended. However, if the character somehow loaded before the player. Assume that the first character you find is player.Character. If it’s not there, connecting CharacterAdded is a gotcha.
If it doesn’t fire at all, there’s probably a different issue apart from the content in the script. Either disabled or the script is not parented correctly.
This line would explain this issue. Because of conflicting variables(object’s name and the name of the object itself), you should change that to avoid this complication. Clone doesn’t exist in the string library.
Sorry for not responding, and I’ll be quite honest, I feel ridiculous for not noticing that. I got off after I asked this question, and I appreciate the help.