so I recently started to work on a loading GUI right
and it requires math
so what I’m doing is using
game:GetService("ContentProvider).RequestQueueSize
now the problem is
I’m trying to do the amount of RequestQueueSize
equal a percentage
so like let’s say
[RequestQueueSize= 0
that means
percentage = 100]
[RequestQueueSize= 50
that means
percentage = 50]
see where I’m going here
it is like making a health GUI
(Health*MaxHealth)/100
I hope you understand what I am saying here if not please ask questions
I’ve been trying to find a solution for hours now
I think you would need to define what the total queue size is first to be able to work this out. For example:
totalQueueSize = 1000
while true do
-- Update RequestQueueSize however you are achieving that
percentComplete = (totalQueueSize/100) * RequestQueueSize
end
This would then need to in a while loop as load takes place so it can constantly be recalculated
local rqs = game:GetService(“ContentProvider”).RequestQueueSize
local StartingValue = rqs
game:GetService(“RunService”).RenderStepped;Connect(function()
local rqs = game:GetService(“ContentProvider”).RequestQueueSize
local newvalue = rqs
if newvalue > StartingValue then
newvalue = startingvalue
end
if newvalue = 0 then
–[Do whatever code here for loading screen]
end
end)
[There may still be some problems with this but I’m pretty sure it can be done]
With the help of you, I think I’m getting somewhere
Problem is once RequestQueueSize hits 0
PercentComplete as well hits 0
I need the opposite of this to happen
for example
RequestQueueSize = 0
PercentComplete = 1 or .5(For GUI loading)
[Please ask questions if anyone doesn’t understand]
I don’t know how you are handling the loop to redo the calculation each time. What I would suggest now is to catch when the RequestQueueSize <= 1 then break the loop
So, within the loop, before it calculates the percentComplete:
if RequestQueueSize <= 1 then
break
end
That should break you out of the loop you are in, but hopefully won’t break you out of the script enitrely.