So I just finish coding my loading screen and its ok, but I want to improve it in two ways: actually make it load better, because when you watch this video, you can see that the car next to were i spawn doesn’t fully load, making me belive that the method i use for my loading screen isn’t good, or can be improved:
Desktop 2021 06 08 09 28 16 05 - YouTube
as you can see from the video, nothing actually loads well, and the loading screen lags a lot. so I’m wondering if there is anyway I can load things better,
I’ve heard of using ContentProvider, but i’m confused on using that, because it seems like its used for loading a few assets, not a whole game, so this is my script that i use for the loading screen:
--vars
local Players = game:GetService("Players")
local ReplicatedFirst = game:GetService("ReplicatedFirst")
local TweenService = game:GetService("TweenService")
local player = Players.LocalPlayer
local playerGui = player:WaitForChild("PlayerGui")
local screengui = script:WaitForChild("LoadingScreen")
local loadingImage = screengui:WaitForChild("ImageLabel")
screengui.Parent = playerGui -- setting GUI Container's parent to PlayerGui
ReplicatedFirst:RemoveDefaultLoadingScreen()--removes the default loading screen.
local tween = TweenService:Create(loadingImage,TweenInfo.new(4,Enum.EasingStyle.Linear,Enum.EasingDirection.In,-1),{Rotation = 360})--tween that i use for the loading screen
tween:Play()
wait(5)
--]]the code below is the method i use for the loading screen, like i said I want to load everything into the game,
--because its a big map and i want to optimize every user's experience-]]
if not game:IsLoaded() then
game.Loaded:Wait()
end
--destroys screenGui once its loaded
screengui:Destroy()
would this also be a better add on as well (to load parts into the game)?
workspace.DescendantAdded:Connect(function(Part)
if Part:IsA("BasePart") then
PartsLoaded += 1
LoadingGUI.Load.LoadingNumber.Text = "Assets loaded: "..tostring(PartsLoaded)
end
end)