Nametags
Key RequiredUniversal

Nametags

Universal ScriptLover_idIeLover_idIe 15K views 135 executesUpdated Nov 1, 2024
Unrated
00
Lua Script•105 lines (3981 chars)
local Players = game:GetService("Players")
local Player = Players.LocalPlayer
local PremiumBadge = " "
local VerifiedBadge = " "
local FriendsBadge = "rbxassetid://18207951972"

local function NameTags(player)
    local function onCharacterAdded(character)
        local humanoidRootPart = character:WaitForChild("HumanoidRootPart", 0.5)
        local head = character:WaitForChild("Head", 0.5)
        
        local NameTag = Instance.new("BillboardGui")
        NameTag.Size = UDim2.new(3, 0, 3, 0)
        NameTag.StudsOffsetWorldSpace = Vector3.new(0, 1.05358, 0)
        NameTag.ExtentsOffsetWorldSpace = Vector3.new(0, 1.4537, 0)
        NameTag.ResetOnSpawn = true
        NameTag.MaxDistance = 50
        NameTag.Adornee = head -- Fix: attach to the head
        NameTag.Name = "NameTag"
        NameTag.Parent = head -- Parent the BillboardGui to the head as well

        local frame = Instance.new("Frame")
        frame.Size = UDim2.new(1, 0, 1, 0)
        frame.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
        frame.BackgroundTransparency = 1
        frame.Parent = NameTag
        frame.Name = "Names"

        local UserName = Instance.new("TextLabel")
        UserName.Text = "(@" .. player.Name .. ")"
        UserName.Font = Enum.Font.FredokaOne
        UserName.Size = UDim2.new(0.7, 0, 0.3, 0)
        UserName.TextSize = 20
        UserName.Position = UDim2.new(0.15, 0, 0.05, 0)
        UserName.TextScaled = true
        UserName.TextWrapped = true
        UserName.BackgroundTransparency = 1
        UserName.TextColor3 = Color3.fromRGB(114, 117, 130)
        UserName.TextStrokeTransparency = 0.5
        UserName.Parent = frame
        UserName.Name = "UserName"

        local DisplayName = Instance.new("TextLabel")
        DisplayName.Size = UDim2.new(2, 0, 0.27, 0)
        DisplayName.BackgroundTransparency = 1
        DisplayName.Text = player.DisplayName
        DisplayName.TextSize = 20
        DisplayName.TextColor3 = Color3.fromRGB(255, 255, 255)
        DisplayName.TextStrokeTransparency = 0.5
        DisplayName.Font = Enum.Font.FredokaOne
        DisplayName.TextScaled = true
        DisplayName.TextWrapped = true
        DisplayName.TextTruncate = Enum.TextTruncate.None
        DisplayName.Position = UDim2.new(-0.50, 0, 0.24, 0)
        DisplayName.Parent = frame
        DisplayName.Name = "DisplayName"
      
        if player.MembershipType == Enum.MembershipType.Premium then
            DisplayName.Text = PremiumBadge .. player.DisplayName
        end
        
        if player.HasVerifiedBadge then
            DisplayName.Text = player.DisplayName .. VerifiedBadge
        end
        
        if player.MembershipType == Enum.MembershipType.Premium and player.HasVerifiedBadge then
            DisplayName.Text = PremiumBadge .. player.DisplayName .. VerifiedBadge
        end
        
        if Player:IsFriendsWith(player.UserId) then
            local FriendsImage = Instance.new("ImageLabel")
            FriendsImage.Size = UDim2.new(0.25, 0, 0.25, 0)
            FriendsImage.Position = UDim2.new(0.385, 0, -0.20, 0) 
            FriendsImage.Image = FriendsBadge
            FriendsImage.BackgroundTransparency = 1
            FriendsImage.Parent = frame
            FriendsImage.Name = "FriendsBadge"
        end

        local Line = Instance.new("Frame")
        Line.Size = UDim2.new(2.11, 0, 0.03, 0)
        Line.Position = UDim2.new(-0.55, 0, 0.5, 0)
        Line.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
        Line.Parent = NameTag
        Line.Name = "Line"

        local Corner = Instance.new("UICorner")
        Corner.CornerRadius = UDim.new(0, 10)
        Corner.Parent = Line
    end

    player.CharacterAdded:Connect(onCharacterAdded)

    if player.Character then
        onCharacterAdded(player.Character)
    end
end

local players = Players:GetPlayers()
for i = 1, #players do
    local player = players[i]
    NameTags(player)
end

Players.PlayerAdded:Connect(NameTags)

Features & Information

Simple Overhead Nametags, I still don't know how to hide the nametags provided by Roblox. I think this still has bugs but it works, it has Premium, Verified, and Friend Badges, Inspired by Dandy's World btw:D
#Nametag#OverheadNametag

Community Comments (0)

No comments yet for this script.

More Scripts for Universal Scripts