ViewportFrame-bourne BillboardGui imitation not working

Hi!

I’ve been trying to get BillboardGuis (Or at least what looks like one) working in ViewportFrames. While I’m well aware that BillboardGuis don’t work in ViewportFrames, I’m trying to imitate the behaviour of one by getting the viewport position of a part on screen, and placing a 2D gui element at the position. I’ve had some success doing this, as demonstrated here:

But I’m currently trying to do the same with a gun, and it’s just not working like in the clip above for some reason. One circle is supposed to go over the magazine, another is supposed to go on the suppressor, and another is supposed to go on the body (The middle) of the gun:

Here are both scripts:

Zombie:

local pos = camera:WorldToViewportPoint(model.Head.Position)
local UIPos = UDim2.fromScale(pos.X, pos.Y) 

objectView.TestFrame.Position = UIPos

Gun:

if muzzle then
	muzzleVector = camera:WorldToViewportPoint(muzzle.Position)
else
	muzzleVector = camera:WorldToViewportPoint(body.Position)
end

local bodyVector = camera:WorldToViewportPoint(body.Position)
local magVector = camera:WorldToViewportPoint(magazine.Position)

local bodyPos = UDim2.fromScale(bodyVector.X, bodyVector.Y)
local magPos = UDim2.fromScale(magVector.X, magVector.Y)
local muzzlePos = UDim2.fromScale(muzzleVector.X, muzzleVector.Y)

local fireLabel = fireRate.PartLabel.Value
local magSizeLabel = magSize.PartLabel.Value
local reloadTimeLabel = reloadTime.PartLabel.Value
local muzzleVelocityLabel = muzzleVelocity.PartLabel.Value

fireLabel.Position = bodyPos
magSizeLabel.Position = magPos
reloadTimeLabel.Position = magPos
muzzleVelocityLabel.Position = muzzlePos

Run this test on the real workspace and debug it there. 5ere is no real way of fixing it other than this method.

there is a way to fix this if you still have this problem.

step 1: make sure to parent the buttons to the viewportframe that you wish to position to the model

step 2: make sure the viewportframe is square shaped or else the buttons will go wrong position

step 3: dont report me for necroposting but its done!