Positioning directional damage indicator correctly

I’m currently making a directional dmg indicator, I got the rotation part handled by using math.atan2 but I’m struggling to compute its’ positional values

This is my current code:

local plr = game.Players.LocalPlayer
repeat wait() until plr.Character

local char = plr.Character
local hrp = char:WaitForChild("HumanoidRootPart")

local RunService = game:GetService("RunService")
local camera = workspace.CurrentCamera

local dmgIndicatorUI = script.Parent.dmgIndicator
local partDealtDmg = workspace.Part3

local absoluteSizeX = dmgIndicatorUI.AbsoluteSize.X / 2
local absoluteSizeY = dmgIndicatorUI.AbsoluteSize.Y / 2

local screenSize = camera.ViewportSize
local midScreenPos = Vector2.new(screenSize.X / 2, screenSize.Y / 2 + game:GetService("GuiService"):GetGuiInset().Y)

RunService.RenderStepped:Connect(function(dt)
	local dir = (partDealtDmg.Position - hrp.Position).Unit
	local camLook = camera.CFrame.LookVector
	
	local rotationInRad = math.atan2(camera.CFrame.RightVector:Dot(dir), camLook:Dot(dir)) 
	
	dmgIndicatorUI.Rotation = math.deg(rotationInRad) -- -math.deg(math.acos(camLook:Dot(dir))) * math.sign(camLook:Cross(dir).Y) (alternative but glitchy)

	dmgIndicatorUI.Position = UDim2.fromOffset(midScreenPos.X + math.cos(rotationInRad) * absoluteSizeX, midScreenPos.Y + math.sin(rotationInRad) * absoluteSizeY)
end)

Basically I want the indicator to rotate AROUND the middle screen in a circle which is why i tried to use math.cos and math.sin. Although it does form a circle, it doesn’t rotate around the pivot point like I initially expected it to: https://gyazo.com/e172a52703ab1b8b59427e112c067fe8
(The main problem isn’t the rotation but the position)

Any help is solemnly appreciated!

Is this what you need?
I think this is the formula that you’re talking about.
Sorry if It’s incorrect.

local dmgIndicatorUI = script.Parent:WaitForChild("dmgIndicator")
local partDealtDmg = workspace:WaitForChild("Part3")
local sizeoffsetx = -dmgIndicatorUI.Size.X.Offset / 2
local sizeoffsety = -dmgIndicatorUI.Size.Y.Offset / 2

game:GetService("RunService").RenderStepped:Connect(function()
	local camera = workspace.CurrentCamera
	local pos = CFrame.new(camera.Focus.Position, camera.Focus.Position + Vector3.new(camera.CFrame.LookVector.X, 0, camera.CFrame.LookVector.Z).Unit):Inverse() * partDealtDmg.Position
	local unit = Vector3.new(pos.X, pos.Z).Unit
	local x = unit.X * 200
	local y = unit.Y * 200
	dmgIndicatorUI.Position = UDim2.new(0.5, x + sizeoffsetx, 0.5, y + sizeoffsety)
	dmgIndicatorUI.Rotation = math.deg(math.atan2(y, x))
end)

Sadly your code’s result is extremely similar to mine, and I think the rotation is a bit inaccurate due to the offset (I dont think you can get the rotation with the offset, unsure though)

https://gyazo.com/325ba1d4daf444eb770883e5961b11ba

Thanks in advance.

EDIT: Managed to solve this on my own