Can Vector2 values be converted to UDIM2 values

Hi I was wondering how Vector2 values, if possible, can be converted to Udim2 values , as in do the X and y from the vector 2 represent the offset or scale component, respectively

1 Like


local V2 =,2)
--converting to scale
local scale =,0,V2.Y,0)
--converting to offset
local offset =,V2.X,0,V2.Y)
--or you can have them represent the Width/height
local ud =,V2.Y)
local UD_Width =,ud)
local UD_Height =,
--or using 2 vector2
local v1 =,2)
local v2 =,5)
local ud1 =,v1.Y)
local ud2 =,v2.Y)
local UD1 =,ud2)
local UD2 =,ud1)

I tried using it like you did for scale and it does not work

It wouldn’t work for scale considering that a Vector2 is expressed in pixels across the screen. It only works as far as offset goes, if you intend to use a raw Vector2 value for UDim2 inputs.

I can’t quite remember how to convert a Vector2 to scale - I believe it involves dividing one of the coordinates by the matching coordinate of the AbsoluteSize of the Gui. Scale is expressed in a percentage so this should make sense.


Here a link to a blog post about it if anyone needs it in the future