Loading screen script bugging

Whenever my friends play test the game to see the loading screen i made it always breaks but it works find for me when i play test but whenever i do a team test it breaks.

Heres whats happening when it breaks.

Basically i get this error: attempt to index nil with 'Enabled' Heres the kicker whenever i click the error to have it take me to the script the script has nothing in it and its the right script cause i checked.

This is the code thats supposed to be in it:

local repstorage = game:GetService("ReplicatedStorage")
local repfirst = game:GetService("ReplicatedFirst")
local contentprovider = game:GetService("ContentProvider")
local ts = game:GetService("TweenService")


local startergui = game:GetService("StarterGui")

local assets = game:GetDescendants()


local ui = script.LoadingScreenGui:Clone()

local player = game.Players.LocalPlayer
local playergui = player:WaitForChild("PlayerGui")

startergui:SetCoreGuiEnabled(Enum.CoreGuiType.All,false)


repfirst:RemoveDefaultLoadingScreen()

repeat wait() until game.Loaded

ui.Parent = playergui




for i=1, #assets do
	local asset = assets[i]
	
	contentprovider:PreloadAsync({asset})
	
	ui.MainFrame.Asset.Text = "Assets:["..i.."/"..#assets.."]"
end

local event = repstorage:WaitForChild("MenuEvent")
local TextChatService = game:GetService("TextChatService")
TextChatService:FindFirstChildOfClass("ChatInputBarConfiguration").Enabled = false
TextChatService:FindFirstChildOfClass("ChatWindowConfiguration").Enabled = false
print("Loading Complete")
ui.MainFrame.Asset.Text = "Loading Complete"
task.wait(1)
ui.MainFrame.Asset.Text = "Please wait..3"
task.wait(1)
ui.MainFrame.Asset.Text = "Please wait..2"
task.wait(1)
ui.MainFrame.Asset.Text = "Please wait..1"
task.wait(1)
ui.MainFrame.Asset.Text = "Please wait..0"
task.wait(1)

	event:Fire()
ui:Destroy()
script:Destroy()

The place the script and gui is at:

image

If you have any information on why this is happening please let me know.

What do you mean by that? Can you show a video?

1 Like

That’s odd, should be a studio bug, try restarting studio and then reproduce it again.

1 Like

I have restarted studio. character limit

Inside your script, Line 39, it tries to “.Enabled” to a nil value. I would recomment just disabling the coreGUI while loading.

StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.All, false) before loading
--Loading waits and such
StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.All, true) after loading.
1 Like

Try putting it inside of a pcall and if it fails, have it continuously try until it works

1 Like

Try removing this part of the script. That might fire nil, since you’ve disabled chat above

1 Like

That doesnt disable the chat though as im not using the legacy chat.

Ah alright. :slight_smile:

But either way, it seems to be the problem, at least the problem is at line 39 as stated.

1 Like

It is definitely the problem though i need to disable chat when using the loading screen im pretty sure the problem is is that since the script is in rep first its trying to get TextChatService before its loaded or before parts of it is loaded anyways how can i turn off chat without it erroring?

Have you tried TextChatService:WaitForChild(…)?

1 Like

Same error occurs. character limit