How could I prevent a player from being able to chat?

I want to make a system where when a specific event happens a player cant chat, but they can still read what everyone else is saying, until another event undoes it. Is this possible without creating a custom chat system?
edit: im sorry im posted this a little to late im tired I though the music would keep me up. ill be checking in like 9 hours ish

local StarterGui = game:GetService('StarterGui');

StarterGui:SetCoreGuiEnabled(enum.CoreGuiType.Chat, false);

https://developer.roblox.com/en-us/api-reference/function/StarterGui/SetCoreGuiEnabled

1 Like
local ChatService = game:GetService("ChatService")
ChatService:GetChannel(“All”):MuteSpeaker(playername)
3 Likes

This will just disable the whole chat system meaning you won’t be able to see the chat history.

1 Like

a player cant chat, but they can still read what everyone else is saying

2 Likes
local Game = game
local StarterGui = Game:GetService("StarterGui")

repeat
	local Success = pcall(function() StarterGui:SetCore("ChatBarDisabled", true) end)
	task.wait()
until Success
2 Likes