Toggle the Chat Menu when the chat's topbar icon is disabled without forking

Is it possible at all to toggle the default chat menu on and off, without forking the chat scripts, when the chat’s core gui is disabled?
i.e. game:GetService('StarterGui'):SetCoreGuiEnabled(Enum.CoreGuiType.Chat, false)

As some context, I’m looking to re-create the newly proposed topbar, whilst maintaining full control over the design and functionality of these icons (excluding the Roblox menu icon).

https://i.gyazo.com/9729b1ef281cf23629f1d3c8dc172ee1.mp4

I’ve attempted to use the SetCore method, although this doesn’t appear to work when the chat’s core gui is disabled:

game:GetService("StarterGui"):SetCore("ChatActive", true)
1 Like

SetCore has a function called CoreGuiChatConnections which you can use to control more aspects of the chat, such as firing Chatted or controlling the icon’s unread badge. It has a ToggleVisibility event which should be able to do what you’re asking for.

(dev hub has an example code for that SetCore at the very bottom of the page)

4 Likes

The page can be confusing in parts, although I believe I’ve setup a coded example correctly…

local targetName = "ChatWindow"
local name = "ToggleVisibility"
local signal = Instance.new("BindableEvent")
signal.Name = targetName.."_"..name
signal.Parent = script

game:GetService("StarterGui"):SetCore("CoreGuiChatConnections", {
	[targetName] = {
		[name] = signal,
	};
})

while true do
	wait(1)
	signal:Fire(true)
	wait(1)
	signal:Fire(false)
end

I’m running this in a LocalScript and tried both ToggleVisibility and SetVisible although nothing appears to happen. Any thoughts on correcting this?

1 Like

This code works fine for me in an actual game (not in studio):

game.StarterGui:SetCoreGuiEnabled("Chat", false)
ChatConnections.ChatWindow.VisibilityStateChanged:Fire(true)

You might need to reconnect chat bar events


Edit: for any future lurkers with a similar problem, we’ve come to a better solution in PMs with the OP:

game.StarterGui:SetCoreGuiEnabled("Chat", false)
local ChatMain = require(game.Players.LocalPlayer.PlayerScripts.ChatScript.ChatMain)
ChatMain.CoreGuiEnabled:fire(true)
ChatMain:SetVisible(true)
6 Likes

For any future future lurkers (those who use new TextChatService), just copy the documentation’s code found at StarterGui | Documentation - Roblox Creator Hub (search for CoreGuiChatConnections) but make sure to not copy the last part, as it doesn’t do much.

After that, you’d essentially be working with all the sets of events and functions you need! So have fun tinkering with corescripts.

EDIT:
Beware of some misleading documentation in specifically VisibilityStateChanged, it only changes the visibility state based on the value you fire to it when you use the method :Fire(). So instead of giving it true, give it the actual state of your chatGUI.