Make Loading Screen Purposely Take Time

Hello! I want to make this loading screen purposely take time so I can display tips and icons and such but I’m not sure how to get this into my script.

Right now, it immediately loads with no wait.

I understand it could depend on peoples internet speed or the contents in the game, but I’d like to really ensure that I can get some content in there.

The model I’m using
:arrow_down:
Better Loading Screen™

I have been digging through all the scripts related to the UI and haven’t found anything that could have to do with how the screen loads.

Here are all the scripts that I have for the UI

Content Service Script

Located in ReplicatedFirst
Content Service Script

print("ContentService loading")

local ReplicatedFirst = game:GetService("ReplicatedFirst")
local ContentProvider = game:GetService("ContentProvider")

local Assets = game:GetDescendants()

local UI = script.LoadingScreen:Clone()
script.LoadingScreen:Destroy()

local plr = game:GetService("Players").LocalPlayer
local plrGui = plr:WaitForChild("PlayerGui")

ReplicatedFirst:RemoveDefaultLoadingScreen()
print("Default loading screen removed")

UI.Parent = plrGui

wait(13.7)
local startTime = os.clock()
for i = 1, #Assets do
	local asset = Assets[i]
	local fill = UI:WaitForChild("Main"):WaitForChild("LoadingBar"):WaitForChild("Fill")
	local loading = UI:WaitForChild("Main"):WaitForChild("LoadingBar"):WaitForChild("loading")
	
	ContentProvider:PreloadAsync({asset})
	loading.Text = "Loading experience - "..asset.Name.. ", " ..i.. "/" ..#Assets
	fill.Size = UDim2.new(i/#Assets, 0, 1, 0)
end

local main = UI:WaitForChild("Main")

local tweenService = game:GetService("TweenService")
local tweenInfo = TweenInfo.new(2.5, Enum.EasingStyle.Exponential, Enum.EasingDirection.InOut)
local tween = tweenService:Create(main, tweenInfo, {Position = UDim2.new(0.5, 0, 2, 0)})

if game:IsLoaded() then
	tween:Play()
	tween.Completed:connect(function()
		game:GetService("StarterGui"):SetCoreGuiEnabled(Enum.CoreGuiType.All, true)
		game:GetService("TextChatService"):WaitForChild("ChatWindowConfiguration").Enabled = true
		game:GetService("TextChatService"):WaitForChild("ChatInputBarConfiguration").Enabled = true
	end)
	
	--Un-comment the below by deleting the --[[ and ]]--. ❗Only for use if you have TopbarPlus❗ Use it by renaming the LocalScript in StarterPlayerScripts to 'iconMaker'.
	--See TopbarPlus documentation here: https://1foreverhd.github.io/TopbarPlus/
	--[[
	local plrScripts = plr:WaitForChild("PlayerScripts")
	local icon = plrScripts:WaitForChild("iconMaker")
	
	wait(2.5)
	icon.Enabled = true
	]]--
end

local deltaTime = os.clock() - startTime
print(("Loading complete, time: %.2f"):format(deltaTime))
Elements Script

Located in the Main UI Frame
elements Script

wait(13.2)

local bar = script.Parent.LoadingBar

local tweenService = game:GetService("TweenService")
local tweenInfo = TweenInfo.new(2.5, Enum.EasingStyle.Exponential, Enum.EasingDirection.InOut)
local tween = tweenService:Create(bar, tweenInfo, {Position = UDim2.new(0.5, 0, 0.958, 0)})

tween:Play()

tween.Completed:connect(function()
	print("Loaded loading bar and elements")
end)
Fade Script

Located in the “Authors” Text Label
image

print("Initialising")

print("Disabling coreguis")
game:GetService("StarterGui"):SetCoreGuiEnabled(Enum.CoreGuiType.All, false)
game:GetService("TextChatService"):WaitForChild("ChatWindowConfiguration").Enabled = false
game:GetService("TextChatService"):WaitForChild("ChatInputBarConfiguration").Enabled = false

local tweenService = game:GetService("TweenService")

local timeToFade = 2.5
local object = script.Parent
local tweenInfo = TweenInfo.new(timeToFade)
local goal = {}

goal.TextTransparency = 0

local tween = tweenService:Create(object, tweenInfo, goal)

wait(1)
tween:Play()

tween.Completed:connect(function()
	local function w(object, text)
		for i = 1, #text, 1 do
			object.Text = string.sub(text, 1, i)
			wait(0.1)
		end
	end
	
	w(script.Parent.present, "Presents to you...") --Presents, present, etc.
end)

wait(3.5)
local textObject1 = script.Parent
local textObject2 = script.Parent.present
local ti = TweenInfo.new(timeToFade)
local g = {}

g.TextTransparency = 1

local t1 = tweenService:Create(textObject1, ti, g)
local t2 = tweenService:Create(textObject2, ti, g)
t1:Play()
t2:Play()

wait(1)
t1.Completed:connect(function()
	local timeToFade = 2.5
	local object = script.Parent.gameName
	local gName = game.Name
	local tweenInfo = TweenInfo.new(timeToFade)
	local goal = {}

	goal.TextTransparency = 0

	local tween = tweenService:Create(object, tweenInfo, goal)
	
	object.Text = gName
	tween:Play()
	
	tween.Completed:connect(function()
		local timeToFade = 2.5
		local object = script.Parent.gameName
		local tweenInfo = TweenInfo.new(timeToFade)
		local goal = {}

		goal.TextTransparency = 1

		local tween = tweenService:Create(object, tweenInfo, goal)
		
		wait(1)
		tween:Play()
		
		tween.Completed:connect(function()
			wait(2.5)
			print("Loading experience")
		end)
	end)
end)

I included all of the scripts as I’m not sure which one can make the change. (I’m horrible at programming)

Thank you for your assistance,
Vicky

1 Like

Consider making a main menu screen which presents itself after the loading screen completes, there you can display tips but also a start button in case users dont want to see them.

3 Likes

that’s because it’s an actual loading screen. It probably uses the function that is called when the game actually loads. which takes not nearly as long as loading screens like er:lc or something.

2 Likes

Thank you, I’ll try to find another way!!

2 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.