If anyone is still having issues the following snippet should solve your problem. Just place it in ReplicatedFirst.
--//===================== Services =====================-//-
local StarterGui = game:GetService("StarterGui")
--//===================== Utility =====================-//-
local GetCoreGuiEnabled = function(coreGuiType: Enum.CoreGuiType) : boolean
return StarterGui:GetCoreGuiEnabled(coreGuiType)
end
local SetCoreGuiEnabled = function(coreGuiType: Enum.CoreGuiType, enabled: boolean): ()
StarterGui:SetCoreGuiEnabled(coreGuiType, enabled)
end
local GetCore = function(paramaterName: string): any
local s = false
local v
repeat s = pcall(function() v = StarterGui:GetCore(paramaterName) end) if not s then task.wait() end until s
return v
end
local SetCore = function(paramaterName: string, value: any): ()
local s = false
repeat s = pcall(function() StarterGui:SetCore(paramaterName, value) end) if not s then task.wait() end until s
end
--//===================== CoreGuiChatConnections =====================-//-
local chatWindowVisibilityChangedBindable = Instance.new("BindableEvent")
local chatWindowVisibilityChanged = chatWindowVisibilityChangedBindable.Event
local chatWindowVisibilityBindable = Instance.new("BindableEvent")
local chatWindowVisibility = chatWindowVisibilityBindable.Event
local messagesChangedBindable = Instance.new("BindableEvent")
local messagesChanged = messagesChangedBindable.Event
local db = 2
local VisibilityChanged = function()
local active = GetCore("ChatActive")
local coreGuiEnabled = GetCoreGuiEnabled(Enum.CoreGuiType.Chat)
local visible = active and coreGuiEnabled
chatWindowVisibilityBindable:Fire(visible)
if visible then messagesChangedBindable:Fire(-1) end
if db < 2 then db += 1 return end
db = 0
SetCoreGuiEnabled(Enum.CoreGuiType.Chat, not coreGuiEnabled)
SetCoreGuiEnabled(Enum.CoreGuiType.Chat, coreGuiEnabled)
end
chatWindowVisibilityChanged:Connect(VisibilityChanged)
SetCore("CoreGuiChatConnections", {["ChatWindow"] = {["ToggleVisibility"] = chatWindowVisibilityChangedBindable, ["SetVisible"] = chatWindowVisibilityChangedBindable, ["TopbarEnabledChanged"] = chatWindowVisibilityChangedBindable, ["CoreGuiEnabled"] = chatWindowVisibilityChangedBindable, ["VisibilityStateChanged"] = chatWindowVisibilityBindable, ["MessagesChanged"] = messagesChangedBindable}})
VisibilityChanged()