Loading Screen problem

Hey DevForum,

I’m having this problem where the script is returning this message to console:
image

Is anyone able to help me out here?

--// Author: @Midnightific
--// Handles the initial setup and the loading screen.

--// Variables
local Players = game:GetService("Players")
local StarterGui = game:GetService("StarterGui")
local RunService = game:GetService("RunService")
local ReplicatedFirst = game:GetService("ReplicatedFirst")
local ContentProvider = game:GetService("ContentProvider")
local UserInputService = game:GetService("UserInputService")

--// Initialisation
local LocalPlayer = Players.LocalPlayer
local PlayerGui = LocalPlayer.PlayerGui
local LoadingScreen = script.Parent.LoadingScreen

--// Prevent VR as best as possible.
local function DisableVR()
	if UserInputService.VREnabled then
		LocalPlayer:Kick("VR is not optimised for this game, disconnect all VR related devices and rejoin.")
	end
end

--// LoadingScreen Setup
local function loadingScreenSetup()
	local mainBox = LoadingScreen.MainBox
	local statusContainer = mainBox.Container
	local statusLabel = statusContainer.Status

	local endLoadingEarly = false

	LoadingScreen.Parent = PlayerGui

	while (ContentProvider.RequestQueueSize > 0 and not endLoadingEarly) or not game:IsLoaded() do
		statusLabel.Text = "Loading assets and required information...".. ContentProvider.RequestQueueSize
	end

	local mainScreen = PlayerGui:WaitForChild("MainScreen", 100)
	local mainScreenIsLoaded = mainScreen and mainScreen:WaitForChild("IsLoaded", 100)

	if mainScreen then
		while not mainScreen.Value do
			statusLabel.Text = "Setting up the donation center..."
		end

		mainScreen.Enabled = true
	end
end

LoadingScreen:Destroy()

local function Call()
	ReplicatedFirst:RemoveDefaultLoadingScreen()
	StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.All, false)
	
	DisableVR()
	loadingScreenSetup()
end

UserInputService:GetPropertyChangedSignal("VREnabled"):Connect(DisableVR)

Call()

It’s saying that yet it’s parented to the Loading Screen:
image

You may need to :WaitForChild() as it may not have replicated yet.

local mainBox = LoadingScreen:WaitForChild("MainBox")
1 Like

I did:

local mainBox = LoadingScreen:FindFirstChild("MainBox")

and that worked but now it’s returning another error message on the line below it.
image

1 Like

Do the same thing for the container.

local statusContainer = mainBox:FindFirstChild("Container")
1 Like

Yeah, that fixed it, thanks but now it’s skipping the entire loading screen.

1 Like

Do you have a cord? I’d have to see exactly what’s going on.

1 Like

I do. I’ll send you a Private Message.

1 Like