I’m trying to make a nametag that’s bottom-positioned instead of being overhead. I’ve tried using an “anchor” part by creating a transparent part that has a weld, which somewhat got me in the direction I wanted, however, it was directly on top of the player’s feet instead of being forward a bit. This led me to writing a script that uses an attachment instead (with the help of ChatGPT honestly, cameras/positioning isn’t really my forte so I apology in advance):
game.Players.PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function(character)
local hrp = character:WaitForChild("HumanoidRootPart")
local attachment = Instance.new("Attachment")
attachment.Name = "NameTagAttachment"
attachment.Parent = hrp
-- Billboard GUI
local billboard = Instance.new("BillboardGui")
billboard.Adornee = attachment
billboard.Size = UDim2.new(0, 200, 0, 50)
billboard.StudsOffset = Vector3.new(0, -3, -1)
billboard.AlwaysOnTop = true
billboard.Name = "BottomNameTag"
billboard.Parent = hrp
-- TextLabel inside
local label = Instance.new("TextLabel")
label.Size = UDim2.new(1, 0, 1, 0)
label.BackgroundTransparency = 1
label.TextSize = 20
label.TextColor3 = Color3.new(1, 1, 1)
label.TextStrokeTransparency = 0.5
label.Font = Enum.Font.FredokaOne
label.Text = player.DisplayName
label.Parent = billboard
end)
end)
This gives me a result of:
Which is super close to what I want to achieve, however, I’d like it to be pushed out away from the character a bit. The biggest issue I’m facing is the fact that my camera is scripted as:
local Players = game:GetService("Players")
local RunService = game:GetService("RunService")
local player = Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local camera = workspace.CurrentCamera
camera.CameraType = Enum.CameraType.Scriptable
local function updateCamera()
character = player.Character
if not character or not character:FindFirstChild("HumanoidRootPart") then return end
local rootPart = character.HumanoidRootPart
local camOffset = Vector3.new(0, 10, -20)
local camPos = rootPart.Position + camOffset
local lookAt = rootPart.Position + Vector3.new(0, 5, 0)
camera.CFrame = CFrame.new(camPos, lookAt)
end
RunService.RenderStepped:Connect(updateCamera)
What I mean by that is a lot of already existing tutorials have not worked. What am I missing here? User error? A limitation in the way Roblox objects can be placed? I appreciate everyone’s time & assistance in advance. Here’s a pic of my intended outcome for reference, I just want the name: