No chat on death?


	function GM:OnPlayerChat( Player, strText, TeamOnly, PlayerIsDead )
		local ChatSystem = {}
			
			if(PlayerIsDead) then
			table.insert(ChatSystem Color(255, 30, 80) )
			table.insert(ChatSystem, "[Dead]")
		end
	end

Thats the code. How would I be able to make the make unable to chat on death?

If ( !ply:Alive() )


	function GM:OnPlayerChat( Player, strText, TeamOnly, PlayerIsDead )
		local ChatSystem = {}
			
		if ply:Alive() then
			table.insert(ChatSystem Color(255, 30, 80) )
			table.insert(ChatSystem, "[Dead]")
                else
                        ply:ChatPrint("You must be alive to use the chat.")
		end
	end

Serverside.

[lua]
hook.Add(“PlayerSay”, “BlockDeadChat”, function(pl, text, tm)
if (!pl:Alive()) then
pl:ChatPrint(“You must be alive to use chat.”)
return “”
end
end)
[/lua]