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