How to hide the chat?

Yes, because of the new chat system

1 Like

It don’t work because of the new chat system, (Is the first thing at my code)

local players = game:GetService("Players")
local LPlayer = players.LocalPlayer
local UserInputS = game:GetService("UserInputService")
local Gui = script.Parent
local MainF = Gui:WaitForChild("MainFrame")
local Typer = MainF:WaitForChild("Typer")
local SendB = Typer:WaitForChild("Send")
local MessageS = MainF:WaitForChild("MessagesScrolling")
local StarterGui = game:GetService("StarterGui")
local MessagesNum = 0

local TextChatS = game:GetService("TextChatService")
local Channel:TextChannel = TextChatS:WaitForChild("TextChannels"):WaitForChild("RBXGeneral")
local TextS = game:GetService("TextService")

local ToCloneF = script:WaitForChild("TextFrame")
local ToCloneMessage = script:WaitForChild("Message1")
local SizeOfSrolling = 0

local MessagesT = {}
for i = 1, 50, 1 do
	table.insert(MessagesT, 0)
end


repeat wait() until LPlayer.Character
StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.Chat, false)

2 Likes

In the new chat system, chat cannot be completely disabled using traditional methods. However, you can still customize the chat behavior and hide the default chat visuals.

local Players = game:GetService("Players")
local LocalPlayer = Players.LocalPlayer
local PlayerGui = LocalPlayer.PlayerGui

-- Oculta o chat padrĂŁo do Roblox
local function HideDefaultChat()
    PlayerGui:SetTopbarTransparency(1) -- Torna a barra superior transparente
    PlayerGui:SetChatWindowActive(false) -- Desativa a janela de chat
end

HideDefaultChat()

This code will make the top bar transparent and disable the default Roblox chat window. However, it’s still important to point out that the new TextChatService chat system can accommodate additional reservations for chat customization and handling.

1 Like

Ok, thanks! I will use it rn. (Addind the code)

1 Like

SetCoreGuiEnabled still works with the new chat system. I tested it out now.

Are you sure it didn’t error? The SetCoreGuiEnabled can error. That’s why it is wrapped in a pcall to handle the error.

3 Likes

Yes, im pretty sure. Anyways, let me add it at the end of the code

1 Like

Please try the method again. No matter how much I run the code I created, the chat is disabled.

We can also take a look at your code that disables the chat.

4 Likes

Look: What I see:
image
Script:

local players = game:GetService("Players")
local LPlayer = players.LocalPlayer
local UserInputS = game:GetService("UserInputService")
local Gui = script.Parent
local MainF = Gui:WaitForChild("MainFrame")
local Typer = MainF:WaitForChild("Typer")
local SendB = Typer:WaitForChild("Send")
local MessageS = MainF:WaitForChild("MessagesScrolling")
local StarterGui = game:GetService("StarterGui")
local MessagesNum = 0

local TextChatS = game:GetService("TextChatService")
local Channel:TextChannel = TextChatS:WaitForChild("TextChannels"):WaitForChild("RBXGeneral")
local TextS = game:GetService("TextService")

local ToCloneF = script:WaitForChild("TextFrame")
local ToCloneMessage = script:WaitForChild("Message1")
local SizeOfSrolling = 0

local MessagesT = {}
for i = 1, 50, 1 do
	table.insert(MessagesT, 0)
end

function GetColorByNumber(Number)
	local StringS = string.split(tostring(Number), "")
	local R = StringS[#StringS-2]
	local G = StringS[#StringS-1]
	local B = StringS[#StringS]
	local ToReturn = Color3.fromRGB(tonumber(R)*28.33, tonumber(G)*28.33, tonumber(B)*28.33)
	return ToReturn
end


UserInputS.InputBegan:Connect(function(input, impedido)
	if input.KeyCode == Enum.KeyCode.C and not impedido then
		Typer:CaptureFocus()
	end
end)

Typer.FocusLost:Connect(function(Enter)
	if Enter then
		Channel:SendAsync(Typer.Text)
	end
end)

SendB.MouseButton1Click:Connect(function()
	Channel:SendAsync(Typer.Text)
end)

Channel.MessageReceived:Connect(function(IncomingMessage)
	local TotalContainerSize = 294
	local MessageF = ToCloneF:Clone()
	MessagesNum += 1
	MessageF.LayoutOrder = MessagesNum
	MessageF.Parent = MessageS
	local SenderUserId = IncomingMessage.TextSource.UserId
	MessageF.UsernameTL.Text = " ["..players:GetPlayerByUserId(SenderUserId).Name.."]: "
	MessageF.UsernameTL.TextColor3 = GetColorByNumber(SenderUserId)
	local NumOfMessage = 1
	local StringS = IncomingMessage.Text:split(" ")
	local TextBoundsX = MessageF.UsernameTL.TextBounds.X
	MessageF.UsernameTL.Size = UDim2.fromOffset(TextBoundsX, 20)
	local TextBoundsY = 0
	for i, Word in pairs(StringS) do
		local TextL = ToCloneMessage:Clone()
		local Prefix = Word:split("")[1]
		if Prefix == "!" then --This conditionat don't work yet, but don't say nothing I will fix it
			TextL.FontFace.Bold = true
			Word = Word:gsub("!", "")
			print("Bold")
		elseif Prefix == "_" then
			TextL.Font = Enum.Font.Code
			Word = Word:gsub("_", "")
		elseif Prefix == "*" then
			TextL.FontFace.Style = Enum.FontStyle.Italic
			Word = Word:gsub("*", "")
		end
		TextL.Text = Word.." "
		TextL.Name = Word
		TextL.Parent = MessageF
		local Needed = TextL.TextBounds.X
		TextL.Size = UDim2.fromOffset(Needed, 20)
		if TextBoundsX +Needed > TotalContainerSize then
			TextBoundsX = 0
			TextBoundsY += 20
		end
		TextL.Position = UDim2.fromOffset(TextBoundsX, TextBoundsY)
		TextBoundsX += Needed
	end
	SizeOfSrolling += TextBoundsY +25
	MessageS.CanvasSize = UDim2.fromOffset(0,SizeOfSrolling)
	MessageF.Size = UDim2.new(1,-6,0, TextBoundsY+20)
	table.insert(MessagesT, MessageF)
	local MessageToDelete = MessagesT[1]
	table.remove(MessagesT, 1)
	if MessageToDelete ~= 0 then
		SizeOfSrolling -= MessageToDelete.Size.Y.Offset
		MessageToDelete:Destroy()
		MessageS.CanvasSize = SizeOfSrolling
	end
	Typer.Text = ""
end)

StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.Chat, false)
1 Like

First of all, SetChatWindowActive and SetTopbarTransparency is not a valid method of PlayerGui. As a matter of fact, there is no official documentation regarding the method.

You are being suspicious here. Your code contains comments in another language, and you used a method that doesn’t exist. Are you using ChatGPT?

4 Likes

Are there any errors in the output regarding CoreGui?

You could also take a screenshot of your output so we can analyze it.

2 Likes

Sure, let me show you:


The warn of No item id submited is other thing

1 Like

Did you enable Error messages to be displayed? You can check if it is enabled by going to the Output window and look for a dropdown like this:
image

1 Like

Yes, tes, Is enabled (I have never disabled any type of logs)
image

1 Like

Here.

local Players = game:GetService("Players")
local LocalPlayer = Players.LocalPlayer

local TextChatService = game:GetService("TextChatService")
local TextChannels = TextChatService.TextChannels
local Channel = TextChannels:GetChannel("DefaultChannel")

local ChatGui = script.Parent -- ReferĂȘncia ao GUI do chat
local Typer = ChatGui.MainFrame.Typer -- ReferĂȘncia ao objeto de digitação de mensagem
local SendButton = Typer.Send -- BotĂŁo de envio de mensagem
local MessagesScrolling = ChatGui.MainFrame.MessagesScrolling -- Área de rolagem das mensagens

-- Função para enviar uma mensagem
local function SendMessage(message)
    if message ~= "" then
        TextChatService:SendMessageToChannel(Channel, message)
    end
end

-- Função para exibir uma mensagem no chat
local function DisplayMessage(playerName, message)
    local messageFrame = ChatGui.MessageTemplate:Clone()
    messageFrame.Visible = true
    messageFrame.NameLabel.Text = playerName
    messageFrame.MessageLabel.Text = message
    messageFrame.Parent = MessagesScrolling
end

-- Evento de mensagem recebida
Channel:GetPropertyChangedSignal("Messages"):Connect(function()
    local messages = Channel.Messages
    local lastMessage = messages[#messages]
    if lastMessage then
        DisplayMessage(lastMessage.FromSpeaker, lastMessage.Message)
    end
end)

-- Evento de clique no botĂŁo de envio
SendButton.MouseButton1Click:Connect(function()
    local message = Typer.Text
    SendMessage(message)
    Typer.Text = "" -- Limpa o campo de digitação após o envio da mensagem
end)

-- Evento para rolar a ĂĄrea de mensagens
MessagesScrolling:GetPropertyChangedSignal("CanvasPosition"):Connect(function()
    -- Atualize a posição das mensagens conforme a årea de rolagem é movida
    MessagesScrolling.Position = UDim2.new(0, 0, 0, -MessagesScrolling.CanvasPosition.Y)
end)

I made an example code here, the dialogue lines are in Portuguese (yes, I’m Brazilian) but it won’t make it difficult to understand it.

Make sure you have a user interface (GUI) called “ChatGui” that contains the necessary objects, such as “MainFrame” for the main structure of the chat, “Typer” for the message typing field, “Send” for the button for sending and “MessagesScrolling” for the message scrolling area.

It is also necessary to have a template object called “MessageTemplate” inside the “MessagesScrolling” to display incoming messages.

2 Likes

Yes, but how to disable the deatful Chat system box?

1 Like

He is probably just sending code from ChatGPT. Don’t trust it.

2 Likes

→ Seriosly bro? Ok, ok. I’ll let it go, better not stress.

2 Likes

I mean, there’s really not anything to “not trust” here, but the code is fairly irrelevant to OP’s problem since it’s just a half-written rewrite

2 Likes

To recap. You have SetCore and StarterGui, right? Attempts to set the ChatWindowPosition property to an off-screen position, making the box invisible.

1 Like

What we could try is to add a “retry” when SetCoreGuiEnabled is called.

I wrote a function for it:

local StarterGui = game:GetService("StarterGui")
local maxRetries = 5

local function DisableChat()
	local retries = 0
	local success,message
	repeat
		success,message = pcall(function()
			StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.Chat, false)
		end)
		if not success then
			retries += 1
			task.wait(1)
		end
	until success == true or retries == maxRetries
	if not success then
		error(message)
	end
end

Call the function when you want to disable the Chat.

2 Likes