How to change the position of a image depending on the size of a text label

I’m working on a custom player name tag and am requiring it to have an image label next to the text to show off premium/star code creators/rbx admins. Right now I’ve got the text scaling correctly depending on the length of the users name but when it comes to the image I’m stuck on how to correctly position it:
(the part thats not in use is for texting reasons only right now)

local BillboardGui = script.Parent
local NameText = BillboardGui.NameText
local Character = BillboardGui.Parent.Parent
local Icon = BillboardGui.Icon
--BillboardGui.Parent = Character:WaitForChild("Head")

NameText.Size = UDim2.new(tonumber("0."..math.round(string.len(Character.Name) / 2)), 0,0.5, 0) 
NameText.Text = Character.Name
Icon.Position = UDim2.new(NameText.Size.X.Scale - (0.03 * string.len(Character.Name)), 0, 0.25, 0)
2 Likes

I figured it out, just used 0.5,0.5 anchor points and then used this script:

Icon.Position = UDim2.new(0.475 - (0.025 * string.len(Character.Name)), 0,0.25, 0) 

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.