How would I convert a UDim2 to Vector3?

Hi! I’m trying to make a blur effect on my ui. (I got it all working, using a camera trick.) The problem is, it’s at the center. So my idea is to get the screen resolution, and try to convert that to a Vector3 value, so I can divide the Y in half and put it at the bottom. Any idea how I could do this?

I tried using this module, but couldn’t get it to work (1) ScreenSpace Module - Roblox

you would use ScreenGui.AbsoluteSize, it’s a Vector 2.

Wow that module sure brings back memories. Just so you know, a lot of things in the module aren’t needed anymore since Roblox added new functions to do the same.
https://developer.roblox.com/en-us/api-reference/function/Camera/WorldToViewportPoint
https://developer.roblox.com/en-us/api-reference/function/Camera/ScreenPointToRay
https://developer.roblox.com/en-us/api-reference/function/Camera/ScreenPointToRay
And a few other good ones. You might want to read up and try again with these.

2 Likes

That doesn’t help, I need a vector 3. I want to convert a UDim2 to Vector3

I’m not sure what you mean. UDim2 represents a position in 2D space and Vector3 represents a position in 3D space.

Do you mean you want to use the X and Y components of the UDim2 to place a part in 3D space?

local udim2 = UDim2.new(0,42,0,45)

local part = Instance.new('Part')
part.Parent = workspace
part.Position = Vector3.new(udim2.X.Offset, udim2.Y.Offset, 0)

Yeah, that is what i want. I just dont know how to do it

What??? Just use the .X and .Y

AbsoluteSize is in pixels, Vector3 is in studs. Maybe if you could tell me how many pixels in a stud that’d work but currently what you’re saying wouldnt work

More or less, a stud is 50 pixels.

1 Like

Thanks! I’ll try that out and see if it works

Okay, in the future maybe just say that because converting studs to pixels isn’t the same as what you initially described. You would use Camera:WorldToScreenPoint().