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.
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
And that is all I need to put inside of the LocalScript?
At least, that’s for disabling/enabling the chat. You can just add your part of your code after you disable/enable the chat.
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.
Okay thanks a lot for your help, I will test the script out and let you know if it works.
I believe it should, but if it doesn’t, do let me know.
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.
Of course, feel free to do so.
Do inform me on whether it worked!
Okay thank you so much. You’re a great help.
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?
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.
So I add an RemoteEvent into Replicated Storage, and place a Server Script where? I’m just confused sorry.
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.
Yeah I just want the chat to be disabled. Also how would I execute the default mute command if a TextButton is clicked.
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).
No worries I have watched a video and figured out how to do it.
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.