Enabling chat without topbar, but being able to disable/re-enable at anytime

Ok, so at first all I did was disable the top bar, but have
module.ChatOnWithTopBarOff = true
set in the ChatSettings, and so the chat worked fine. The Top bar was disabled and the chat still worked. However, now I have an intro that plays when the player joins, and so I disable the chat (so it’s not in the way)

Then I re-enable the chat once the intro has finished.

This has however caused the chat to just never show up now.

StarterGui:SetCore('TopbarEnabled', false)
StarterGui:SetCoreGuiEnabled('Chat', false)

Then later

StarterGui:SetCoreGuiEnabled('Chat', true)

I know the top bar disables all CoreUI, but this chat setting meant it worked before. So how can I work around this? Seen other games (that use Roblox default chat) have the topbar removed and no chat during their intros, but then re-enable the chat later on, while keeping the topbar disabled.

Is there any easy way to disable the chat scripts from running until I want them to run?

Please fully read the question before answering :upside_down_face:

Quick Suggestion


How about no and PlayerGui:SetTopbarTransparency()?

Addendum:
Perhaps disabling the topbar and enabling the topbar again will help? In other words, reversing the process.

1 Like

Don’t want that, as there is no way to remove the PlayerName and +13 on the top right hand side of the screen (above the PlayerList) even when every CoreUI is disabled.

So I have to disable the TopBar so that doesn’t show up.

^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Alternative


Your alternative solution would be a replacement of a custom chat over it. There’s no way we can bring back the UI element without setting the TopbarEnabled true.

Mentioned in the first part of my question

And if we look here at Adopt Me


There’s no chat, TopBar is completely gone, etc. But when the game loads, the top bar is still not there, but the chat is. They use the default roblox chat too

Perhaps that chat is a replica of the default one by extracting the scripts and the UI along with it? I could figure that this is a hacky workaround.

Was it only the chat?

Ye it was only the chat. Top bar was definately disabled, as it doesnt have the players name in the top right corner

I’d point out it was a workaround by extracting the scripts and UI of it to your game. It’s actually not the default chat, but a copy of it. :thinking:

I’ve already got all the Chat modules inside Chat (in studio, not the default game ones)

How can I get around this then? Cause if take them out, the default ones will be used (which I cant have that)

Sadly, I’m not experienced with using the modules. Perhaps the next person who’ll reply have a better clue of implenting this or even a better clue of how it actually works.

:frowning:

You could fork the ChatServiceRunner and make it lazy load the chat service or stall running any components until you flag it to do so. ChatServiceRunner eagerly loads all the chat system core modules.

I’m not sure what’s wrong with your original implementation though? This is fine and how it should be done. I made a repro in less than a minute that keeps the topbar removed and can flip between the chat being enabled and disabled. You don’t need to stop scripts from running just to accomplish this. That would cause unintended issues anyway.

local StarterGui = game:GetService("StarterGui")
local UserInputService = game:GetService("UserInputService")

UserInputService.InputBegan:Connect(function (InputObject, GameProcessedEvent)
	if not GameProcessedEvent then
		if InputObject.KeyCode == Enum.KeyCode.C then
			local Flip = not StarterGui:GetCoreGuiEnabled("Chat")
			StarterGui:SetCoreGuiEnabled("Chat", Flip)
		end
	end
end)

StarterGui:SetCore("TopbarEnabled", false)

-- In repro as well: ChatSettings with ChatOnWithTopbarOff = true
2 Likes

Are you able to share the save file? Cause I just tried this and it does not work
Chat test.rbxl (131.8 KB)

1 Like

I saved the file and ran a local server without changing a single thing. It worked as intended. Press the slash key after each time you press C and you’ll see that you’re able to chat or that the window disappears.

1 Like