Compass system help

Hello, I was creating a compass UI and I came across this issue in the system where the compass would revolve a full 360-degree spin if it goes from 360 degrees to 0 degrees and vice versa as shown in the video.

What it should look like is this:

Here’s my code

local cam, camPart = workspace.CurrentCamera, workspace.CameraPart
local absoluteSize = 0

local function partToCamera() camPart.CFrame = cam.CFrame end

local Label = script.Parent.Bearing

local Circle = script.Parent.Rotational

local tweenInfo =,Enum.EasingStyle.Linear,Enum.EasingDirection.Out,0,true)
local tweenInfo2 =,Enum.EasingStyle.Linear,Enum.EasingDirection.Out,0,false)
local ts = game:GetService("TweenService")

function Round(n, decimals)
	decimals = decimals or 0
	return math.floor(n * 10^decimals) / 10^decimals

local function moveWithOrientation()
	local Or = camPart.Orientation.Y
	local deg = 0
	if Or < 0 then deg = 180 + (180 + Or) else deg = Or end
	deg = 360 - deg
	local inc = (absoluteSize * 4) / 360
	Label.Text = Round(deg,0)  
	if deg == 360 or 0 then
		local Tween2 = ts:Create(Circle,tweenInfo2,{Rotation = Round(deg,0)}):Play()
		local Tween = ts:Create(Circle,tweenInfo,{Rotation = Round(deg,0)}):Play()





I used @TheCarbyneUniverse’s post to create this system so credits to him!

Instead of using tweening set the position with trigonometry. What we have here is the degrees (relative to origin?) and the magnitude of the frames to the origin. We are basically just applying a sine and cosine offset from there origin at an angle of 0 degrees.
If we simply treat the sine as y and the cosine as x we can simply do this to get the position from the angle

local curAngle = 90
local x = math.cos(curAngle)
local y = math.sin(curAngle)
frame.Position = + x, offsetOrigin+y)

You can play with it here Angle (Degrees) and Unit Circle

The script doesn’t work by moving the position, it works by rotating the ImageLabel as shown in the picture

Don’t know about that then, I guess you can multiple the orientations to get a local rotation of them relative to the rotation of the compass