How do i disable chat in my loading screen?

I made a loading screen and i want to disable chat on it but i dont know a good way how its NOT the legacy chat.
its the TextChatService chat so :SetCoreGuiEnabled(Enum.CoreGuiType.All,false) will NOT work using the new chat disabling method for TextChatService doesnt work either heres another post of mine that states what happens

This is the script and script and gui location.

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")
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()

image

4 Likes

I did some testing and all you have to do is this

--disable
StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.Chat,false)
TextChatService.ChatWindowConfiguration.Enabled = false
TextChatService.ChatInputBarConfiguration.Enabled = false

--enable
StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.Chat,true)
TextChatService.ChatWindowConfiguration.Enabled = true
TextChatService.ChatInputBarConfiguration.Enabled = true

I improved and made your script more readable

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local ReplicatedFirst = game:GetService("ReplicatedFirst")
local ContentProvider = game:GetService("ContentProvider")
local TweenService = game:GetService("TweenService")
local StarterGui = game:GetService("StarterGui")
local TextChatService = game:GetService("TextChatService")
local ui = script.LoadingScreenGui:Clone()
local player = game.Players.LocalPlayer
local playergui = player:WaitForChild("PlayerGui")


ReplicatedFirst:RemoveDefaultLoadingScreen()
repeat wait() until game.Loaded

StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.Chat,false)
TextChatService.ChatWindowConfiguration.Enabled = false
TextChatService.ChatInputBarConfiguration.Enabled = false

ui.Parent = playergui

local assets = game:GetDescendants()
local assetsLoaded = 0
for _,asset in ipairs(assets) do
	task.spawn(function()
		ContentProvider:PreloadAsync({asset})
		assetsLoaded += 1
		ui.MainFrame.Asset.Text = "Assets:["..assetsLoaded.."/"..#assets.."]"
	end)
end
repeat wait() until assetsLoaded == #assets

print("Loading Complete")
ui.MainFrame.Asset.Text = "Loading Complete"
for i=3,1,-1 do
	ui.MainFrame.Asset.Text = "Please wait.. "..i
	task.wait(1)
end

StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.Chat,true)
TextChatService.ChatWindowConfiguration.Enabled = true
TextChatService.ChatInputBarConfiguration.Enabled = true

ReplicatedStorage:WaitForChild("MenuEvent"):Fire()
ui:Destroy()
script:Destroy()

The biggest improvement is spawning PreloadAsync
On my test place there were 9k parts. You code took 30 secs. Spawning them in their own thread took 0.5 secs. That’s because we have to wait for preload to do it’s thing every single time before we move on. Spawning removes the wait before we start the next preload. All we have to do is make sure we finished loading everything repeat wait() until assetsLoaded == #assets

3 Likes

Getting this error now.

image

So odd as I’m not getting this error at all. What is the path location of your script?
print(script:GetFullName())

1 Like

The path location is ReplicatedFirst.LoadingScreenScript

1 Like

I think it tries to load RepFirst before the TextChat has time to create it’s stuff.
Try moving LoadingScreenScript to StarterPlayerScripts

It works but shouldnt a loading screen be in repfirst since its loading assets in or am i wrong about that?

Edit: the asset number doesnt ever get to its goal for some reason.

you could do this:

for _,asset in ipairs(assets) do
	task.spawn(function()
		ContentProvider:PreloadAsync({asset})
		assetsLoaded += 1
		if assetsLoaded / #assets >= 0.8 then return end
		ui.MainFrame.Asset.Text = "Assets:["..assetsLoaded.."/"..#assets.."]"
	end)
end
repeat wait() until assetsLoaded / #assets >= 0.8

So it really doesn’t matter since the timing on the users perspective is negligible. But if you put it in repfirst you need to wait till the TextChatService need to do it’s thing anyway.

1 Like