Is there a way to disable a players chat?


Achieve

My goal is to make a command that allows me to mute a player/prevent them from chatting with others in the server they’re muted in.

Where I looked

I looked at the Chat service and I saw nothing in it. I don’t know where else to look.


Thank you for your input.

Post Answer

The answer given is a more in-depth answer, however @regexman was the first to give me the solution needed.

1 Like

Look at the ChatSettings script when you test the game and edit it.

1 Like

game:Get Service(“StarterGui”):SetCoreGuiEnabled(“Chat”,false)

Put this in a local script.

How do I inject this to a player?

just clone the local script to a player.

1 Like

The solution depends on your use-case. If you want the chat to entirely be disabled (including the back-end), toggle off LoadDefaultChat.

If you only want the chat to be visibly disabled, but allow the back-end to still exist for future use, use game:GetService("StarterGui"):SetCoreGuiEnabled(Enum.CoreGuiType.Chat, false).

1 Like

If you could, please elaborate on what you mean by back-end.

To put simply, if you toggle off LoadDefaultChat, the chat system will just not load. Other solutions will make it invisible.

2 Likes

That or you just have a fired PlayerAdded event which checks the name of the player and if they match the name of a blacklisted player then disable the chat for them.

1 Like

Could you give an example of this…? I don’t believe this can be done on the server side.

game.Players.PlayerAdded:Connect(function(plr)
if plr.Name == blacklisted then
Localmutescript:Clone().Parent = plr
end
end)

Oh yeah, and that localmutescript must contain the script I gave earlier.

1 Like

Oh no, I thought @Limited_Unique meant that the chat would be disabled through the server for that person only.

I don’t think that’s possible, that’s the only way I could think of.

As there’s no API to access player coregui. In server

1 Like
local players = game:GetService("Players")
local player = players.LocalPlayer or players.PlayerAdded:Wait()
local starterGui = game:GetService("StarterGui")

if player.Name == "" then --some name
	starterGui:SetCoreGuiEnabled(Enum.CoreGuiType.Chat, false)
end

Local script.

Yeah, you can’t access the CoreGui of a PlayerGui so doing it from a server script wouldn’t be possible.

1 Like