Hi,
Recently I was trying to set my own loading screen using RemoveDefaultLoadingScreen()
function, but it failed. Could someone tell me what I am doing wrong? All my script does is removing the default loading screen, but I only see a void instead of my generated gui.
local Players = game:GetService("Players")
local ReplicatedFirst = game:GetService("ReplicatedFirst")
local player = Players.LocalPlayer
local playerGui = player:WaitForChild("PlayerGui")
local screenGui = Instance.new("ScreenGui")
screenGui.IgnoreGuiInset = true
screenGui.ResetOnSpawn = false
screenGui.DisplayOrder = 5
local screen = Instance.new("Frame")
screen.Active = true
screen.BackgroundColor3 = Color3.fromRGB(0, 0, 0)
screen.BorderSizePixel = 0
screen.Size = UDim2.new(1, 0, 1, 0)
screen.ClipsDescendants = true
local back = Instance.new("Frame")
back.AnchorPoint = Vector2.new(0, 0.5)
back.BackgroundColor3 = Color3.fromRGB(15, 15, 15)
back.BorderSizePixel = 0
back.Position = UDim2.new(0, 0, 0.5, 0)
back.Size = UDim2.new(1, 0, 0.7, 0)
local loading = Instance.new("Frame")
loading.AnchorPoint = Vector2.new(0, 0)
loading.BackgroundColor3 = Color3.fromRGB(0, 0, 0)
loading.BackgroundTransparency = 1
loading.BorderSizePixel = 0
loading.Position = UDim2.new(0, 0, 0, 0)
loading.Size = UDim2.new(1, 0, 1, 0)
local loadingtext = Instance.new("TextLabel")
loadingtext.AnchorPoint = Vector2.new(1, 0.5)
loadingtext.BackgroundTransparency = 1
loadingtext.Position = UDim2.new(0.99, 0, 0.927, 0)
loadingtext.Size = UDim2.new(0.983, 0, 0.05, 0)
loadingtext.ZIndex = 2
loadingtext.Font = Enum.Font.Sarpanch
loadingtext.Text = "Please wait. Loading speed depends on your internet speed."
loadingtext.TextColor3 = Color3.fromRGB(255, 255, 255)
loadingtext.TextScaled = true
loadingtext.TextSize = 32
loadingtext.TextWrapped = true
loadingtext.TextXAlignment = Enum.TextXAlignment.Left
screen.Parent = screenGui
back.Parent = screen
loading.Parent = screen
loadingtext.Parent = loading
screenGui.Parent = playerGui
ReplicatedFirst:RemoveDefaultLoadingScreen()
--wait(3) -- Optionally force screen to appear for a minimum number of seconds
if not game:IsLoaded() then
game.Loaded:Wait()
end
screenGui:Destroy()
I followed this article: ReplicatedFirst:RemoveDefaultLoadingScreen