How to update a circular progress bar based on the player xp

I do not know how to adapt the progress bar depending on the player’s XP. I don’t know how to make the mathematical formula from line 21.

note: this formula 100 + level * 5 is to calculate the required xp for the next level

local leftFrame = script.Parent:WaitForChild("LeftBG"):WaitForChild("LeftFrame")
local rightFrame = script.Parent:WaitForChild("RightBG"):WaitForChild("RightFrame")


local ts = game:GetService("TweenService")
local ti = TweenInfo.new(5, Enum.EasingStyle.Quint, Enum.EasingDirection.InOut)


local numValue = game.Players.LocalPlayer.LevelFolder.XP  
local level = game.Players.LocalPlayer.LevelFolder.Level.Value


numValue.Changed:Connect(function()
	
	
	local rightRot = math.clamp(numValue.Value - 180, -180, 0)
	
	rightFrame.Rotation = rightRot
	
	
	if numValue.Value <= (100 + level * 5) / 180 then
		
		leftFrame.Visible = false
		
		
	else
		
		local leftRot = math.clamp(numValue.Value - 360, -180, 0)
		
		leftFrame.Rotation = leftRot
		
		leftFrame.Visible = true
	end
end)


function progressBar()
	
	numValue.Value = 0

	local progressTween = ts:Create(numValue, ti, {Value = 360})
	progressTween:Play()
end


progressBar()

```lua
1 Like