How do I make my progress bar go past 100?

I have recently made a circular progress bar off a tutorial on YouTube however I want to use this progress bar as a magic bar such as a mana bar with my own values. But no matter how hard I try it just goes straight back to 100… Heres the original script!

local tweenService= game:GetService("TweenService")

local progress = script.Parent

local left = progress:WaitForChild("Left"):WaitForChild("Circle")
local right = progress:WaitForChild("Right"):WaitForChild("Circle")
local center = progress:WaitForChild("Centre")

local percentage = Instance.new("NumberValue")

percentage:GetPropertyChangedSignal("Value"):Connect(function()
	local rotation = math.floor(math.clamp(percentage.Value * 3.6, 0, 360))

	right.UIGradient.Rotation = math.clamp(rotation, 0, 180)
	left.UIGradient.Rotation = math.clamp(rotation, 180, 360)
end)

task.wait()

local tween = tweenService:Create(
	percentage, 
	TweenInfo.new(1, Enum.EasingStyle.Quart, Enum.EasingDirection.Out),
	{
		Value = math.random() * 100
	}
)

tween:Play()

That is the script and I want to use it so that the circle around it doesn’t fill in fully at 100 and it fills half way at like 500 not 50

idk but currently the rotation is calculated as percentage.Value * 3.6, which assumes a maxiumum value of 100 (since 100 * 3.6 = 360 degrees if I do know math correctly).

this script is full of magic and should work:

local tweenService= game:GetService("TweenService")

local progress = script.Parent

local left = progress:WaitForChild("Left"):WaitForChild("Circle")
local right = progress:WaitForChild("Right"):WaitForChild("Circle")
local center = progress:WaitForChild("Centre")

local percentage = Instance.new("NumberValue")

percentage:GetPropertyChangedSignal("Value"):Connect(function()
    local rotation = math.floor(math.clamp(percentage.Value / 1000 * 360, 0, 360))

    right.UIGradient.Rotation = math.clamp(rotation, 0, 180)
    left.UIGradient.Rotation = math.clamp(rotation, 180, 360)
end)

task.wait()

local tween = tweenService:Create(
    percentage, 
    TweenInfo.new(1, Enum.EasingStyle.Quart, Enum.EasingDirection.Out),
    {
        Value = math.random() * 1000  -- Adjusted to match the new scale
    }
)

tween:Play()

also if this is helpful:

Desired Maximum Value Calculation for rotation
100 (original) percentage.Value * 3.6
200 percentage.Value / 200 * 360
500 percentage.Value / 500 * 360
1000 percentage.Value / 1000 * 360
2000 percentage.Value / 2000 * 360

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.