I have a loading screen that uses this code but the loading screen takes a very very long time so I was woundering if there was any way to speed up the loading. I’m sorry if the code looks weird I do not know how to correctly upload the code to this post.
local MainScreenGui = script.Parent
MainScreenGui.Enabled = true
local camera = workspace.CurrentCamera
local player = game.Players.LocalPlayer
local ContextActionService = game:GetService(“ContextActionService”)
local character = player.Character or player.CharacterAdded:Wait()
character:WaitForChild(“HumanoidRootPart”).Anchored = true
local waitFrame = script.Parent:WaitForChild(“WaitFrame”)
waitFrame.BackgroundTransparency = 0
local cameraPart = workspace:WaitForChild(“CameraPart”)
camera.CameraType = Enum.CameraType.Scriptable
camera.CFrame = cameraPart.CFrame
local ContentProvider = game:GetService(“ContentProvider”)
local MainFrame = MainScreenGui:WaitForChild(“MainLoadingScreen”)
local TweenService = game:GetService(“TweenService”)
local blur = game.Lighting:WaitForChild(“Blur”)
blur.Enabled = true
local statsGui = script.Parent.Parent:WaitForChild(“StatsGui”)
local upgradeGui = script.Parent.Parent:WaitForChild(“UpgradeGui”)
statsGui.Enabled = false
upgradeGui.Enabled = false
local FadeTween = TweenService:Create(MainScreenGui.WaitFrame, TweenInfo.new(0.5, Enum.EasingStyle.Linear, Enum.EasingDirection.Out), {BackgroundTransparency = 1})
FadeTween:Play()
repeat wait() until game:IsLoaded()
local GameAssets = game:GetDescendants()
local TotalGameAssets = #GameAssets
local LoadBar = MainFrame:WaitForChild(“BackgroundBar”):WaitForChild(“MovingBar”)
LoadBar.Size = UDim2.new(0, 0, 1, 0)
local function updateLoadingText(progress)
MainFrame:WaitForChild(“ProgressText”).Text = string.format(“Assets Loading: %d/%d”, progress, TotalGameAssets)
end
MainFrame:WaitForChild(“ProgressText”).Text = “Assets Loading: 1/” … TotalGameAssets
wait(0.5)
for i, assetToLoad in ipairs(GameAssets) do
ContentProvider:PreloadAsync({assetToLoad})
updateLoadingText(i)
LoadBar.Size = UDim2.new(i / TotalGameAssets, 0, 1, 0)
end
local FadeInTween = TweenService:Create(MainScreenGui.Fade, TweenInfo.new(0.5, Enum.EasingStyle.Linear, Enum.EasingDirection.Out), {BackgroundTransparency = 0})
FadeInTween:Play()
FadeInTween.Completed:Wait()
wait(0.5)
MainFrame.Visible = false
blur:Destroy()
camera.CameraType = Enum.CameraType.Custom
character:WaitForChild(“HumanoidRootPart”).Anchored = false
statsGui.Enabled = true
upgradeGui.Enabled = true
local FadeOutTween = TweenService:Create(MainScreenGui.Fade, TweenInfo.new(0.5, Enum.EasingStyle.Linear, Enum.EasingDirection.Out), {BackgroundTransparency = 1})
FadeOutTween:Play()
FadeOutTween.Completed:Wait()
I have tried looking through the dev forum to find a way to speed up a loading screen and I have tried looking at multiple videos for a better loading screen. Any help is appreciated. Thank you.
-Asher