Chat notification question

Is it possible to make a notification in the chat after the action? (I have a modular script and I want to send a chat message to EVERYONE after an action, I’m using the old chat service)

1 Like

could you show us your module script

This is a module script, it kicks the player (in general, this is the admin panel)

local module = {
	Name = 'Kick',
	Description = "Kicked player",
	Location = "Player",
}

module.Execute = function(Client, Type, Attachment)
	if Type == "command" then
		local player = module.API.getPlayerWithName(Attachment)
		local cp = require(script.Parent.Parent.Parent.Parent.SystemPackages.Settings)
		if cp.Permissions[cp.Admins[Attachment]] and cp.Permissions[cp.Admins[Attachment]].Priority>=cp.Permissions[cp.Admins[Client.Name]].Priority then
			return false
		end
		if player then
			local Input = module.API.sendModalToPlayer(Client, "Reason").Event:Wait()
			local Status
			Status, Input = module.API.filterText(Client, Input)
			if not Input or Input=="" then Input="" end

			local success, result = module.API.filterText(Client, Input)

			if success and result then
				player:Kick(Client.Name.. " ("..Input..")) kicked")
				return true
			end
			return false
		end
	end
end

return module

add a remote event in repstorage and name it “CommandMessage”

local module = {
	Name = 'Kick',
	Description = "Kicked player",
	Location = "Player",
}

module.Execute = function(Client, Type, Attachment)
	if Type == "command" then
		local player = module.API.getPlayerWithName(Attachment)
		local cp = require(script.Parent.Parent.Parent.Parent.SystemPackages.Settings)
		if cp.Permissions[cp.Admins[Attachment]] and cp.Permissions[cp.Admins[Attachment]].Priority>=cp.Permissions[cp.Admins[Client.Name]].Priority then
			return false
		end
		if player then
			local Input = module.API.sendModalToPlayer(Client, "Reason").Event:Wait()
			local Status
			Status, Input = module.API.filterText(Client, Input)
			if not Input then Input = "" end

			local success, result = module.API.filterText(Client, Input)

			if success and result then
				player:Kick(Client.Name.. " ("..Input..")) kicked")
                game:GetService("ReplicatedStorage").CommandMessage:FireAllClients("Somebody has been kicked!")
				return true
			end
			return false
		end
	end
end

return module

local script in starterplayerscripts:

game:GetService("ReplicatedStorage"):WaitForChild("CommandMessage").OnClientEvent:Connect(function(message)
   game:GetService("TextChatService").TextChannels.RBXGeneral:DisplaySystemMessage(message)
end)

This for LegacyChatSystem or for new textChatSystem?

oh you’re right i forgot it’s meant to be old :sweat_smile:

can you fix it now with old textChatSystem?