i want it to search through a folder and set max stage to the highest number
local player = game.Players.LocalPlayer
local stage = player:WaitForChild("leaderstats"):FindFirstChild("Stage")
local workspace = game.Workspace
local maxStage
for _, stage in workspace.Stages:GetChildren() do
maxStage = tonumber(stage.Name, maxStage)
end
local function updateProgress()
local percentage = (stage.Value / maxStage) * 100
script.Parent.ProgressFrame.Bar:TweenSize(UDim2.new(0, (percentage / 100 * 490), 1, 0), "Out", "Linear", 1)
script.Parent.ProgressFrame.Percent.Text = string.format("%d%%", percentage)
end
updateProgress()
stage.Changed:Connect(updateProgress)
i know i can use tonumber() but dont know how exactly to use it for this specific use case