Okay so, I have a loading screen, with a count the shows how many things that are loaded, and the total that should be loaded.
Here’s what it’s like:
Here’s the script for it:
script.Parent:RemoveDefaultLoadingScreen()
local loadingScreen = script.ScreenGui
local plr = game.Players.LocalPlayer
--local cutSceneScript = game:GetService("ReplicatedStorage").CutsceneScript
loadingScreen.Parent = game.Players.LocalPlayer.PlayerGui
local contentProvider = game:GetService("ContentProvider")
game.Loaded:Wait()
local toLoad = workspace:GetDescendants()
local total = #toLoad
for i,v in pairs(toLoad) do
loadingScreen.Background.Counter.Text = "Loading: " .. i .. "/" .. total
loadingScreen.Background.BarBG.Bar.Size = UDim2.new(i/total, 0, 1, 0)
contentProvider:PreloadAsync({v})
end
-- Finished loading
wait(1)
print("Removing loading screen..")
local clientLoadedEvent = game:GetService("ReplicatedStorage"):WaitForChild("Events").ClientLoaded
clientLoadedEvent:FireServer(plr)
loadingScreen.Background:TweenPosition(UDim2.new(0, 0, 0, 2000), Enum.EasingDirection.Out, Enum.EasingStyle.Quint)
local gui = plr.PlayerGui:WaitForChild("MenuGUI")
gui.Enabled = true
wait(1)
loadingScreen:Destroy()
How could I possibly convert that count to a percentage? I’d like to do this, as a percentage would look better, and easier to understand how much there is to load.