How do I turn vector3 to udim2

Trying to tween a part and size, but I want to tween its position to go above the head, but I need the head position, how do I put head.Position to udim2

W o t

You could just add a offset instead to tween the Part? No need to use UDim2 for this, you can probably do something like:

local PartPos = Head.Position + Vector3.new(0, 5, 0)

I wanted it to tween nicely, but edit: Oh wait- yeah I just noticed

Have you looked at TweenService for this? There’s an entire Service dedicated to tween those kind of properties

It sounds like you’re asking how to get the 2D position of the head as it’s rendered:

local camera = workspace.CurrentCamera

local player = game.Players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local head = character:WaitForChild("Head")

-- this is the line that matters:
local pos2d = camera:WorldToScreenPoint(head.Position)

-- it's a Vector2 so we can convert
local posUDim = UDim2.fromOffset(pos2d.X, pos2d.Y)

-- use it like normal
print(posUDim)
1 Like