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

Removing a message?

Will a script like this remove a message? I want to make silent commands. But I don't know how, if possible, to remove messages..

game.Players.PlayerAdded:connect(function(Player)
	local CheckAdmin = emodule.CheckAdmin(Player)
	if CheckAdmin then
		Player.Chatted:connect(function(Chat)
			Chat:Remove()
		end)
	end
end)

4 comments

0

It's impossible to remove chats without a custom Chat Gui.

0

Dang it.

0

You could use the emotes system to get around having others seeing your chats

0

It would be pretty easy to use a textbox to enter commands, rather than the chat, yeah?

1 answer

✓ Accepted answer

You could use ROBLOX's emotes system or /e, to simulate a "silent" command. Using the substitution function of the string library, you could check if the user's message starts with /e, and proceed accordingly.

I will just edit the snippet you've provided with minor additions to demonstrate just what it is I'm talking about.

game.Players.PlayerAdded:connect(function(Player)
	local CheckAdmin = emodule.CheckAdmin(Player)
	if CheckAdmin then
		Player.Chatted:connect(function(Chat)
			-- Chat is the string chatted by `Player`
			-- Check if the first two characters start are '/e'
			if string.sub(Chat, 1, 2) == '/e' then
				-- if yes, consider everything after words
				-- to avoid issues with distinguishing commands
				-- from chat.
				Chat = string.sub(Chat, 4)
				print('secret chat')
			else
				print('not-so-secret')
			end
		end)
	end
end)

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