Disabling an Player's Chat

How would I go about disabling a player’s chat when they first join the game and when they load in their chat would be automatically enabled again. I also need to know how to disable their chat when they get muted because I created an moderation panel and there is a mute button on it to mute them and unmute them so I just need to know how would I go about doing this.

2 Likes

You can run SetCoreGuiEnabled() to disable the chat for the LocalPlayer (yes, this must be in a LocalScript!)

Here is a sample of how your code should look like when you try and disable/enable the Player’s chat.

game.StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.Chat, true) -- enabling the chat

game.StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.Chat, false) -- disabling the chat
6 Likes

And that is all I need to put inside of the LocalScript?

1 Like

At least, that’s for disabling/enabling the chat. You can just add your part of your code after you disable/enable the chat.

2 Likes

Also I have a question, would this also hide the button to open/close their chat? The button and chat box would only not be visible until they are unmuted.

1 Like

Okay thanks a lot for your help, I will test the script out and let you know if it works.

1 Like

I believe it should, but if it doesn’t, do let me know.

1 Like

Okay I will do that, I will go ahead and test it out now but I need to ask you some questions in private messages if you don’t mind.

2 Likes

Of course, feel free to do so.

Do inform me on whether it worked!

1 Like

Okay thank you so much. You’re a great help.

:sweat_smile:

1 Like

How would I make this script run if the player’s username is inside of the TextBox? And would the chat only disable for that player?

1 Like

You can make a RemoteEvent that fires from the Server to the Client. From the LocalScript, you can add it to the StarterGUI, and make it such that when the RemoteEvent fires to the client, the script disables the chat for the Player.

2 Likes

So I add an RemoteEvent into Replicated Storage, and place a Server Script where? I’m just confused sorry.

1 Like

Why are you disabling everything just out of interest? The OP only asked for chat to be disabled, not leaderboard, inventory, emotes etc as well.

I’d advise the OP to change the “All” part of your script to “Chat” only.

1 Like

Yeah I just want the chat to be disabled. Also how would I execute the default mute command if a TextButton is clicked.

2 Likes

You mean something like /mute [username]? I think you’d have to write custom code for that, since the mute functionality is part of chat, and I’m not sure you’d be able to mute someone through pressing a button.

I haven’t done a great deal of work with chat unfortunately to provide any more help (I don’t have a clue how to deal with the new TextChatService).

1 Like

No worries I have watched a video and figured out how to do it.

2 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.