RoGo Magazine - Custom Loading Screens

.

Posted in Tutorials

January 31, 2015 at 6:27 PM

Custom Loading Screens

By DerAtomik

Editors: Sparker22

NOTE: This tutorial requires basic Lua knowledge.

It’s been a while, but I’m back with another tutorial! Today, I’m proud to show you how to create a custom loading screen for your place! If you didn’t know this was possible, now you do.


GIF courtesy of the ROBLOX Wiki.

Introduction

As it sounds, with custom loading screens, you can replace the default loading screen a player sees when they first enter a game. Not only is this possible, but the API (Service) that makes this possible also allows you to run LocalScripts on a player almost as soon as they enter the game!

Getting started

The API/Service we’ll be using is ReplicatedFirst. It can easily be found in the Explorer. Once you’ve located this, go ahead and insert a LocalScript. You can’t insert a Gui directly, it will not work properly. You’ll unfortunately have to manually create a Gui via your LocalScript.

Replacing the default loading screen

Quick word of advice: Do not remove the screen as soon as the script is replicated to the player. Since some people, including myself, have slower computers, the PlayerGui does not immediately appear on the Player’s Instance. Therefore, you should use the WaitForChild method to wait for it to appear, then remove the screen and insert the replacement.

local player = game.Players.LocalPlayer
local gui = Instance.new("ScreenGui", player:WaitForChild("PlayerGui"))
game.ReplicatedFirst:RemoveDefaultLoadingScreen()
--The following is an example of the new loading screen
--you could possibly create, it doesn't have to be this
--exact one.
local frame = Instance.new("Frame", gui)
frame.Size = UDim2.new(1,0,1,0)
frame.BackgroundColor3 = BrickColor.new("Black").Color
local text = Instance.new("TextLabel", frame)
text.Size = UDim2.new(1,0,1,0)
text.BackgroundTransparency = 1
text.TextScaled = true
text.TextColor3 = Color3.new(1,1,1)
text.Text = "Loading..."
--You can now insert whatever you want to execute.
--Tip: Be sure to remove the script and gui afterward.

Usage ideas

  • Loading assets before the player spawns (this is one of the main purposes of ReplicatedFirst).
  • Adding music for the player to listen to while their game loads.
  • Give credit to the game contributors.
  • Create an awesome logo for the player to be distracted by as their game loads.

Confused? Got a question? Got an idea for the next tutorial? Whatever it may be, always feel free to either leave a comment below or send me a PM on ROBLOX!