code:
--Services
local replicatedfirst = game:GetService("ReplicatedFirst")
local contentprovider = game:GetService("ContentProvider")
local players = game:GetService("Players")
local ts = game:GetService("TweenService")
local blur = game:GetService("Lighting"):WaitForChild("StartBlur")
--variables
blur.Size = 24
local clock = os.clock()
local assets = game:GetDescendants()
local gui = script:WaitForChild("Loading"):Clone()
local plr = players.LocalPlayer
local character = plr.Character or plr.CharacterAdded:Wait()
local human = plr.Character:WaitForChild("HumanoidRootPart").Anchored
local plrgui = plr:WaitForChild("PlayerGui")
human = true
local ti = TweenInfo.new(10,
Enum.EasingStyle.Sine,
Enum.EasingDirection.Out
)
local tg = {Size = 0}
local tc = ts:Create(blur, ti, tg)
--Remove default loading
replicatedfirst:RemoveDefaultLoadingScreen()
--checking if the game loaded
if not game:IsLoaded() then
game.Loaded:Wait()
end
--parent the loading gui
gui.Parent = plrgui
--Load every game descendants
for i = 1, #assets do
local asset = assets[i]
contentprovider:PreloadAsync({asset})
gui:WaitForChild("Frame"):WaitForChild("LoadStatus").Text = "Loading: " ..asset.Name .. " [" .. i .. "/" .. #assets .. "]"end
--the time it took to load
gui:WaitForChild("Frame"):WaitForChild("LoadStatus").Text = ("Loading complete, took %.2f seconds"):format(os.clock() - clock)
task.wait(3)
gui:Destroy()
human = false
tc:Play()
print ("game loaded")
after i added the blur tween it became over 30 times slower. it used to took around 2 seconds now it takes around 70 seconds.