pcall(function()PlayerBlockedEvent=StarterGui:GetCore("\080\108\097\121\101\114\066\108\111\099\107\101\100\069\118\101\110\116")PlayerMutedEvent=StarterGui:GetCore("\080\108\097\121\101\114\077\117\116\101\100\069\118\101\110\116")PlayerUnBlockedEvent=StarterGui:GetCore("\080\108\097\121\101\114\085\110\098\108\111\099\107\101\100\069\118\101\110\116")PlayerUnMutedEvent=StarterGui:GetCore("\080\108\097\121\101\114\085\110\109\117\116\101\100\069\118\101\110\116")end)function SendSystemMessageToSelf(q)local X=ChatWindow:GetCurrentChannel()if X then local M={ID=-1,FromSpeaker=nil;SpeakerUserId=0;OriginalChannel=X.Name;IsFiltered=true,MessageLength=string.len(q),Message=trimTrailingSpaces(q),MessageType=ChatConstants.MessageTypeSystem;Time=os.time(),ExtraData=nil}X:AddMessageToChannel(M)end end function MutePlayer(q)local X=DefaultChatSystemChatEvents:FindFirstChild("\077\117\116\101\080\108\097\121\101\114\082\101\113\117\101\115\116")if X then return X:InvokeServer(q.Name)end return false end if PlayerBlockedEvent then PlayerBlockedEvent.Event:connect(function(q)if MutePlayer(q)then SendSystemMessageToSelf(string.format("\083\112\101\097\107\101\114 \'\037\115\' \104\097\115 \098\101\101\110 \098\108\111\099\107\101\100\046",q.Name))end end)end if PlayerMutedEvent then PlayerMutedEvent.Event:connect(function(q)if MutePlayer(q)then SendSystemMessageToSelf(string.format("\083\112\101\097\107\101\114 \'\037\115\' \104\097\115 \098\101\101\110 \109\117\116\101\100\046",q.Name))end end)end function UnmutePlayer(q)local X=DefaultChatSystemChatEvents:FindFirstChild("\085\110\077\117\116\101\080\108\097\121\101\114\082\101\113\117\101\115\116")if X then return X:InvokeServer(q.Name)end return false end if PlayerUnBlockedEvent then PlayerUnBlockedEvent.Event:connect(function(q)if UnmutePlayer(q)then SendSystemMessageToSelf(string.format("\083\112\101\097\107\101\114 \'\037\115\' \104\097\115 \098\101\101\110 \117\110\098\108\111\099\107\101\100\046",q.Name))end end)end if PlayerUnMutedEvent then PlayerUnMutedEvent.Event:connect(function(q)if UnmutePlayer(q)then SendSystemMessageToSelf(string.format("\083\112\101\097\107\101\114 \'\037\115\' \104\097\115 \098\101\101\110 \117\110\109\117\116\101\100\046",q.Name))end end)end

pcall(function()
	PlayerBlockedEvent = StarterGui:GetCore("PlayerBlockedEvent")
	PlayerMutedEvent = StarterGui:GetCore("PlayerMutedEvent")
	PlayerUnBlockedEvent = StarterGui:GetCore("PlayerUnblockedEvent")
	PlayerUnMutedEvent = StarterGui:GetCore("PlayerUnmutedEvent")
end)

function SendSystemMessageToSelf(message)
	local currentChannel = ChatWindow:GetCurrentChannel()

	if currentChannel then
		local messageData =
		{
			ID = -1,
			FromSpeaker = nil,
			SpeakerUserId = 0,
			OriginalChannel = currentChannel.Name,
			IsFiltered = true,
			MessageLength = string.len(message),
			Message = trimTrailingSpaces(message),
			MessageType = ChatConstants.MessageTypeSystem,
			Time = os.time(),
			ExtraData = nil,
		}

		currentChannel:AddMessageToChannel(messageData)
	end
end

function MutePlayer(player)
	local mutePlayerRequest = DefaultChatSystemChatEvents:FindFirstChild("MutePlayerRequest")
	if mutePlayerRequest then
		return mutePlayerRequest:InvokeServer(player.Name)
	end
	return false
end

if PlayerBlockedEvent then
	PlayerBlockedEvent.Event:connect(function(player)
		if MutePlayer(player) then
			SendSystemMessageToSelf(string.format("Speaker '%s' has been blocked.", player.Name))
		end
	end)
end

if PlayerMutedEvent then
	PlayerMutedEvent.Event:connect(function(player)
		if MutePlayer(player) then
			SendSystemMessageToSelf(string.format("Speaker '%s' has been muted.", player.Name))
		end
	end)
end

function UnmutePlayer(player)
	local unmutePlayerRequest = DefaultChatSystemChatEvents:FindFirstChild("UnMutePlayerRequest")
	if unmutePlayerRequest then
		return unmutePlayerRequest:InvokeServer(player.Name)
	end
	return false
end

if PlayerUnBlockedEvent then
	PlayerUnBlockedEvent.Event:connect(function(player)
		if UnmutePlayer(player) then
			SendSystemMessageToSelf(string.format("Speaker '%s' has been unblocked.", player.Name))
		end
	end)
end

if PlayerUnMutedEvent then
	PlayerUnMutedEvent.Event:connect(function(player)
		if UnmutePlayer(player) then
			SendSystemMessageToSelf(string.format("Speaker '%s' has been unmuted.", player.Name))
		end
	end)
end
