How do I make a custom loading screen fade out after the game is loaded?

Hello,

I’m trying to create a custom loading screen that fades out once the game loading is complete. I’ve got the loading part down, but how do I make it fade out once the game is loaded? Below is the script I’ve tried: (It is a LocalScript)

Thanks for the help!

You are waiting an arbitrary amount of seconds (in your case, 5) which kind of defeats the purpose of your goal.

Just remove that wait(5) call because your game likely loaded within those 5 seconds which means game:IsLoaded() returned true.

1 Like

Still does not fade. It just stays

if not game:IsLoaded() then
game.Loaded:Wait()
end
(change transparency values here)

1 Like

You could just remove the wait(5) and remove the second conditional (if game:IsLoaded() then)

It will work fine after that.

take
if game:IsLoaded then out of if not game:IsLoaded then

if not game:IsLoaded() then
game.Loaded:Wait()
end
for i = 1,100 do
MainFrame.BackgroundTransparency = MainFrame.BackgroundTransparency - 0.01
end

You’re decreasing the BackgroundTransparency while you should be increasing it if you want a fade out effect.

This should work:

local Players = game:GetService("Players")
local ReplicatedFirst = game:GetService("ReplicatedFirst")
local Player = Players.LocalPlayer
local PlayerGui = Player:WaitForChild("PlayerGui")
local LoadingScreenGui = ReplicatedFirst.LoadingScreenGui
local MainFrame = LoadingScreenGui.MainFrame
LoadingScreenGui.Parent = PlayerGui

ReplicatedFirst:RemoveDefaultLoadingScreen()
wait(5)
if (not game:IsLoaded()) then
	game.Loaded:Wait()
end
for i = 1, 100 do
	MainFrame.BackgroundTransparency = MainFrame.BackgroundTransparency + 0.01
	wait()
end
3 Likes