function setPos(character)
local sizeY = character.Head.Size.Y
for i,v in pairs(character:GetChildren()) do
if v:IsA("Accessory") then
local mainPart = v:FindFirstChildWhichIsA("BasePart")
local comp = (mainPart.Size.Y/2)+mainPart.Position.Y > (character.Head.Size.Y/2 + character.Head.Position.Y)
if comp == true then
sizeY += (mainPart.Size.Y/2+mainPart.Position.Y) - (character.Head.Size.Y/2 + character.Head.Position.Y)
else
continue
end
else
continue
end
end
return sizeY
end
game.Players.PlayerAdded:Connect(function(player)
player.CharacterAppearanceLoaded:Connect(function(character)
if character.Humanoid.RigType == Enum.HumanoidRigType.R6 then
local billboardgui = Instance.new("BillboardGui")
billboardgui.MaxDistance = 50
billboardgui.AlwaysOnTop = false
billboardgui.Size = UDim2.new(4,0,1,0)
local NameLabel = Instance.new("TextLabel")
NameLabel.Size = UDim2.new(1,0,0.5,0)
NameLabel.TextScaled = true
NameLabel.Text = player.Name
NameLabel.TextColor3 = Color3.fromRGB(255,255,255)
NameLabel.TextStrokeTransparency = 0
NameLabel.BackgroundTransparency = 0
NameLabel.BackgroundColor3 = Color3.fromRGB(163,162,165)
NameLabel.Parent = billboardgui
NameLabel.Font = Enum.Font.SourceSansBold
local TeamLabel = Instance.new("TextLabel")
TeamLabel.Size = UDim2.new(1,0,0.5,0)
TeamLabel.Position = UDim2.new(0,0,0.5,0)
TeamLabel.TextScaled = true
TeamLabel.Text = player.Team.Name
TeamLabel.TextColor3 = Color3.fromRGB(255,255,255)
TeamLabel.TextStrokeTransparency = 0
TeamLabel.BackgroundTransparency = 0
TeamLabel.BackgroundColor3 = Color3.fromRGB(163,162,165)
TeamLabel.Parent = billboardgui
TeamLabel.Font = Enum.Font.SourceSansBold
billboardgui.ExtentsOffset = Vector3.new(0,setPos(character) + billboardgui.Size.Y.Scale,0)
billboardgui.Parent = character.Head
else
character.ChildAdded:Connect(function(part)
if not character.Head:FindFirstChildWhichIsA("BillboardGui") then
local billboardgui = Instance.new("BillboardGui")
billboardgui.MaxDistance = 50
billboardgui.AlwaysOnTop = false
billboardgui.Size = UDim2.new(4,0,1,0)
local NameLabel = Instance.new("TextLabel")
NameLabel.Size = UDim2.new(1,0,0.5,0)
NameLabel.TextScaled = true
NameLabel.Text = player.Name
NameLabel.TextColor3 = Color3.fromRGB(255,255,255)
NameLabel.TextStrokeTransparency = 0
NameLabel.BackgroundTransparency = 0
NameLabel.BackgroundColor3 = Color3.fromRGB(163,162,165)
NameLabel.Parent = billboardgui
NameLabel.Font = Enum.Font.SourceSansBold
local TeamLabel = Instance.new("TextLabel")
TeamLabel.Size = UDim2.new(1,0,0.5,0)
TeamLabel.Position = UDim2.new(0,0,0.5,0)
TeamLabel.TextScaled = true
TeamLabel.Text = player.Team.Name
TeamLabel.TextColor3 = Color3.fromRGB(255,255,255)
TeamLabel.TextStrokeTransparency = 0
TeamLabel.BackgroundTransparency = 0
TeamLabel.BackgroundColor3 = Color3.fromRGB(163,162,165)
TeamLabel.Parent = billboardgui
TeamLabel.Font = Enum.Font.SourceSansBold
billboardgui.ExtentsOffset = Vector3.new(0,setPos(character) + billboardgui.Size.Y.Scale,0)
billboardgui.Parent = character.Head
end
end)
end
end)
end)