How to make a frame the same size as a part?

So I recently figured out how to position a frame at a parts location by doing this

local M = game.Players.LocalPlayer:GetMouse()
local Cam = game.Workspace.CurrentCamera
function WorldToScreen(Pos) --This function gets a World Position (Pos) and returns a Vector2 value of the screen coordinates
	local point = Cam.CoordinateFrame:pointToObjectSpace(Pos)
	local aspectRatio = M.ViewSizeX / M.ViewSizeY
	local hfactor = math.tan(math.rad(Cam.FieldOfView) / 2)
	local wfactor = aspectRatio*hfactor

	local x = (point.x/point.z) / -wfactor
	local y = (point.y/point.z) /  hfactor

	return Vector2.new(M.ViewSizeX * (0.5 + 0.5 * x), M.ViewSizeY * (0.5 + 0.5 * y))
end

if ShowHitboxes.Value == true then
	local Vec2 = WorldToScreen(Part.Position)
	local Frame = Instance.new("Frame")
	Frame.Size = UDim2.new(0.1,0,0.1,0)
	Frame.Position = UDim2.new(0,Vec2.X-90,0,Vec2.Y+10)
	Frame.BackgroundTransparency = 0.5
	Frame.BackgroundColor3 = Colors[Name]
	Frame.Parent = Main.ScreenGui
	Frame.BorderSizePixel = 0
	table.insert(VisualHitboxs,Frame)
end

However I wanna know if there’s a similar way to also make the size of the frame the same as the part because as you can see from this video the position is pretty accurate but the size isn’t. (the neon part is the actual hitbox which makes connects with the opponent which is invisible the frame is what’s gonna be used to show it)

Having this same problem. Did you end up finding a solution?

Couldn’t you get the vectors of the corners of the part and then use Camera:WorldToScreenPoint? You could then subtract corresponding vectors to find the size of the part in world and on screen.

Similar to what Perilous said, you can use WorldToScreenPoint instead of the function you made to position the squares as well