Troubleshooting a mathematical code

I am having problems with the following:

1. These lines in every loop

TS:Create(script.PercentControl, Slide, {Value = CurrentLength}):Play()
	for i = 0, RandomTime * 10, 1 do
		local PercentageComplete = math.floor(script.PercentControl.Value / --Number-- * 100)
		script.Parent.MidiScreen.First.Text = string.format("Copying installation files (%i%%)", PercentageComplete)
		wait(0.1)
	end

I can’t think of how would I make it work with, for instance for loops or anything else, because using tweens to get the result is annoying and not the best solution.
The problem is most likely connected to the 2nd one

2. The All Finished doesn’t print, as somehow the condition isn’t met, even though it actually is

This odd behavior is really annoying as at the second loop it stops and stays at 99%, even though the X scale is indeed 0.35? If there is a solution of a better way of making a condition here I’d love to hear it.

repeat -- Copying files
	local RandomTime = math.random(3, 8)
	local TimeDelay = math.random(2, 5)
	local RandomAmount = math.random(3, 8) / 200

	CurrentLength += RandomAmount
	if CurrentLength > 0.2 then
		CurrentLength = 0.2
	end
	local Slide = TweenInfo.new(RandomTime, Enum.EasingStyle.Linear)
	TS:Create(script.Parent.Parent.InstallPRO.Progress, Slide, {Size = UDim2.new(CurrentLength, 0, 1, 0)}):Play()
	TS:Create(script.PercentControl, Slide, {Value = CurrentLength}):Play() -- HERE I can't think of how would I make it work with, for instance for loops or anything else, because using tweens to get the result is annoying and not the best solve
	for i = 0, RandomTime * 10, 1 do
		local PercentageComplete = math.floor(script.PercentControl.Value / 0.2 * 100)
		script.Parent.MidiScreen.First.Text = string.format("Copying installation files (%i%%)", PercentageComplete)
		wait(0.1)
	end
	
	wait(TimeDelay)
until script.Parent.Parent.InstallPRO.Progress.Size.X.Scale >= 0.2
warn("Sequence complete")
repeat -- Preparing files
	local RandomTime = math.random(3, 8)
	local TimeDelay = math.random(2, 5)
	local RandomAmount = math.random(3, 8) / 100

	CurrentLength = CurrentLength + RandomAmount
	if CurrentLength > 0.35 then
		CurrentLength = 0.35
	end
	local Slide = TweenInfo.new(RandomTime, Enum.EasingStyle.Linear)
	TS:Create(script.Parent.Parent.InstallPRO.Progress, Slide, {Size = UDim2.new(CurrentLength, 0, 1, 0)}):Play()
	TS:Create(script.PercentControl, Slide, {Value = CurrentLength}):Play()
	for i = 0, RandomTime * 10, 1 do
		local PercentageComplete = math.floor((script.PercentControl.Value - 0.2) / 0.15 * 100)
		script.Parent.MidiScreen.Second.Text = string.format("Getting files ready for installation (%i%%)", PercentageComplete)
		wait(0.1)
	end

	wait(TimeDelay)
until script.Parent.Parent.InstallPRO.Progress.Size.X.Scale >= 0.35
warn("All finished")

Anyways, if anyone has solves of ideas on how to improve the code, please reply.