Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How to block a specific user from chatting?

Hi how do I ban a user from chatting, thanks

game:GetService("Players").PlayerAdded:Connect(function(Player)
	--Code to determine if player is banned from chatting
	if IsBannedFromChatting then
		--What goes here?
	end
end)

1 answer

If you want to ban multiple people you would use a table, but since chatting is locally you would use a local script which I don't think PlayerAdded Would work on it, so you would put the script on player scripts. Having the chat disabled or muted would use the StarterGui which has a function that you can used called SetCoreGuiEnabled which has a lot of uses but for this instance we will turn off the chat, which SetCoreGuiEnabled needs two inputs, the thing you want to alter and the if you want it on or off or true or false, in this case if you don't know them on the top of your head you would use Enum.CoreGuiType. , so it would bring you to a select or dropdown on the things you can choose from, Here is the Code I used that uses what I just said.

local MutedPeople = {"Rayguyban2", "PlayerName"}
local player = game.Players.LocalPlayer
-- Table for List of muted people


local StarterGui = game:GetService("StarterGui")

for i = 1,#MutedPeople,1 do
	if player.Name == MutedPeople[i] then
		-- Loops through whole table and if the person is on the table and then disables the chat for the player affected
		StarterGui:SetCoreGuiEnabled(Enum.CoreGuiType.Chat,  false)

	end
end

This discussion is preserved as it was. New answers, comments, and votes are closed.