Is it possible to change the Size of a UI Frame by decimals?

Hello!

I’m trying to make a loading screen, where the size of the loading bar changes by a decimal place (by dividing the maximum size of the loading bar by the number of parts in the game).
So, the speed of the loading bar depends on the amount of parts in the game.
However, I noticed that I can only change the size of the loading bar by values greater than 1. I can only make the loading bar stay within it’s range by using decimal places (and to have it work accurately.)
Is there any way I can change the size of a loading bar through decimal intervals instead?

Sorry if this is confusing. This is the method I am using to change the size of the frame:
[frame].Parent.Size = UDim2.new(0, script.Parent.Size.X.Offset + [maximumSizeToPartRatio], 0, 19)

How size to part ratio is calculated:

for i, v in ipairs(game.Workspace:GetDescendants()) do
	partCount = partCount + 1
end

partRatio = realMax / partCount
1 Like

You can calculate the Loading Bar progress by this.

local PercentLoaded = PartId / PartMax -- PartId is current loop Idx part is on PartMax is the length of the part list
-- you can use the Scale arguments of UDim2.new()
Loadingbar.Size = UDim2.new(Percent, 0, 1, 0)

What is the current loop Idx part?

Lets say you have a table of parts.
Here is what I mean:

local Parts = PartsFolder:GetChildren()

for PartIdx, Part in ipairs(Parts) do
  local PercentLoaded = PartIdx / #Parts
  Loadingbar.Size = UDim2.new(Percent, 0, 1, 0)
end

Sorry for the first confusing example.