Vector2 to udim2?

so i want to position a gui on a part (without using a billboard gui), so i did camera:WorldToScreenPoint(part.Position), but it returns a Vector2. is there any way i could convert that into an udim2?

1 Like

You can grab X and Y values from Vector2 value, so you can easily convert to UDim2 value:
(this method converts Vector2 to Udim2 with only offset values.)

local pointPos = camera:WorldToScreenPoint(part.Position)

local pointUDim = UDim2.new(0, pointPos.X, 0, pointPos.Y)

You can use UDim2.new() with only offset values but you can also use UDim2.fromOffset():

local pointUDim = UDim2.fromOffset(pointPos.X, pointPos.Y)
3 Likes

the gui doesnt seem to show up at all now

You can paste the code that having problems? And also a screenshot of that issue?

oh man, im dumb i think i see why it didnt work, i made it invisible by an accident, ill reply if it works lol

yea its working now, sorry. my bad!

1 Like