Hiya, scripters! I have recently come across a bug within my nametag script. The nametag will only appear for r15 Blocky characters, and will not appear for people who have headless.
There is no actual bug in the script, I just need it to be compatible for all avatar types.
local rs = game:GetService("ReplicatedStorage")
local nametag = rs.OverheadGUI
local ts = game:GetService("TweenService")
game.Players.PlayerAdded:Connect(function(plr)
plr.CharacterAdded:Connect(function(char)
local head = char.Head
local newtext = nametag:Clone()
local playername = newtext.MainFrame.playername
local playerrank = newtext.MainFrame.playerrank
local humanoid = char.Humanoid
local TAGS = newtext.MainFrame.TAGS
local MOD = TAGS.MODERATOR
local VIP = TAGS.VIP
local DEV = TAGS.DEV
local mp = game:GetService("MarketplaceService")
humanoid.DisplayDistanceType = "None"
newtext.Adornee = head
newtext.Parent = head
playername.Text = plr.Name
playerrank.Text = plr:GetRoleInGroup(9266615)
if plr:GetRankInGroup(9266615) >= 8 then
MOD.Image = "rbxassetid://6586254080"
print("mr added")
else
MOD:Destroy()
end
if mp:UserOwnsGamePassAsync(plr.UserId, 19909540) then
VIP.Image = "rbxassetid://6586252945"
print("vip added")
else
VIP:Destroy()
end
if plr:GetRankInGroup(9266615) >= 17 then
DEV.Image = "rbxassetid://6588399576"
print("dev added")
end
if plr:GetRankInGroup(9271020) >= 3 then
if plr:GetRankInGroup(9271020) <= 7 then
playerrank.Text = plr:GetRoleInGroup(9271020)
print("mod added")
end
end
if mp:UserOwnsGamePassAsync(plr.UserId, 19909540) or mp:UserOwnsGamePassAsync(plr.UserId, 19909571) then
while true do
local color = Color3.new(math.random(), math.random(), math.random())
local tween = ts:Create(playername, TweenInfo.new(3), {TextColor3 = color})
tween:Play()
wait(3)
end
end
end)
end)
All support is appreciated, thank you!