For whatever reason, this does not happen every time. I can’t really discern what makes it happen only some of the time, but it seems to happen more reliably in game than in studio for me. If that example file doesn’t work in studio, try publishing it.
I’m having the same issue in my game, one thing that seems to make it disappear is setting all coregui to not display a second time (when i press the play button) but that’s obviously not how it is supposed to behave
I have tried dozens of things to resolve this issue, but it just continues to persist. I’ve gone as far as adding a yield which waits for the entire game to load + an extra buffer before setting the core and it makes no difference.
It’s seemingly random as to whether the SetCoreGuiEnabled() method is able to remove the core-chat toggle button. It has been a persistent issue for multiple months now.
There also tends to be a disparity between live servers and studio test servers…
Even though I explicitly hide this button in the code yet still shows up in the client, makes it distracting to have a useless internal button sit there with notification icons that will never disappear in the case of my custom chat.
I’d also like to report that playtest no longer seems to hide this button?
It seemed to work just fine in my private bare-bones place that has nothing but the chat functionality about 2 weeks ago, but as soon as it was implemented in a much bigger place last week, this stopped working.
local StarterGui = game:GetService("StarterGui")
for i = 1, 2 do
StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.Chat, true)
task.wait(0.2)
StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.Chat, false)
task.wait(0.2)
end
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()
Hi, just reaching out that I’ve rolled out a change that should help mitigate this. Let me know if you see this issue persisting and I can take another look. Thanks!
Previously there was a race condition that sometimes meant that despite calling SetCoreGuiEnabled as false for chat, the unibar would initialize the state as opened. We’ve since refactored this to no longer rely on the order of events to set the open/close state and things should work as expected now.
This means if you were using any workarounds to force the top bar button to be hidden, you should be able to remove them and replace it with something more idiomatic.