Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How do you make a simple loading screen?

Asked by 4 years ago
0
Have a GUI cover the whole screen and its text could say "Loading...". AntiWorldliness 868 — 4y

2 answers

Log in to vote
1
Answered by
9mze 193
4 years ago
Edited 4 years ago

This part should create a localscript and gui in ReplicatedFirst.

local Loading = Instance.new("LocalScript")
Loading.Name = "Loading"
Loading.Parent = game.ReplicatedFirst

local Main = Instance.new("ScreenGui")
Main.Name = "Main"
Main.Parent = Loading
Main.ZIndexBehavior = Enum.ZIndexBehavior.Sibling

local Image = Instance.new("ImageLabel")
Image.Name = "Image"
Image.Parent = Main
Image.BackgroundColor3 = Color3.fromRGB(255, 255, 255)
Image.BorderColor3 = Color3.fromRGB(0, 0, 0)
Image.BorderSizePixel = 0
Image.Size = UDim2.new(1, 0, 1, 0)

local Label = Instance.new("TextLabel")
Label.Name = "Label"
Label.Parent = Image
Label.BackgroundColor3 = Color3.fromRGB(0, 0, 0)
Label.BackgroundTransparency = 0.500
Label.BorderColor3 = Color3.fromRGB(0, 0, 0)
Label.BorderSizePixel = 0
Label.Position = UDim2.new(0.25, 0, 0.8, 0)
Label.Size = UDim2.new(0.5, 0, 0.1, 0)
Label.Font = Enum.Font.Highway
Label.Text = "Loading . . ."
Label.TextColor3 = Color3.fromRGB(0, 0, 0)
Label.TextScaled = true
Label.TextSize = 15
Label.TextWrapped = true

This part goes inside the loading script in ReplicatedFirst. It will do the 'loading...' until the player has a BoolValue inside them with the name 'Loaded' and it's value is true.

local Players = game:GetService("Players");
local ReplicatedFirst = game:GetService("ReplicatedFirst");

ReplicatedFirst:RemoveDefaultLoadingScreen();

local Player = Players.LocalPlayer;
local PlayerGui = Player:WaitForChild("PlayerGui");

local Loading = script.Loading;

script.Parent = PlayerGui;

local dot = 0;

repeat wait(1)
    if dot == 0 then
        Loading.Image.Label.Text = "Loading";
        dot = 1;
    elseif dot == 1 then
        Loading.Image.Label.Text = "Loading .";
        dot = 2;
    elseif dot == 2 then
        Loading.Image.Label.Text = "Loading . .";
        dot = 3;
    else
        Loading.Image.Label.Text = "Loading . . .";
        dot = 0;
    end
until Player:FindFirstChild("Loaded") and Player:FindFirstChild("Loaded").Value == true;

5 seconds after a player joins, the loading gui will stop. [Script in ServerScriptService]

game.Players.PlayerAdded:Connect(function(player)
    wait(5)
    local a = Instance.new("BoolValue", player)
    a.Name = "Loaded"
    a.Value = player
end)
0
Thanks! R_LabradorRetriever 198 — 4y
Ad
Log in to vote
1
Answered by
Ghost40Z 118
4 years ago
Edited 4 years ago

You can make a ScreenGui with a frame inside(Rename the screen GUI to "LoadingScreen"). Set the frame's offsets to 0 and scale 1 (on both X and Y) and center the frame. Then add a text label and change it's text to "Loading Game, please wait"(or whatever you want). And if you want the Gui to disappear after something happened(for example Player joined the game) You can do it by using a script similar to this(script should be in ServerScriptService)

local Frame = game.Players.LocalPlayer.PlayerGui.LoadingScreen.Frame
Frame.Visible = true

game.Players.PlayerAdded:Connect(function(player) -- script runs when the player joins
    wait(10) --change 10 to whatever time you want the loading to take in seconds
    Frame.Visible = false
end)

Hope this helped.

0
Ghost40Z your so good that you don’t even feel like your a newbie at scripting iivSnooxy 248 — 4y
0
Thx R_LabradorRetriever 198 — 4y
0
I am definetely a new scripter, anything I try to do it kinda.. Doesn't work most of the time and I spend days working on it Ghost40Z 118 — 4y

Answer this question