Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Removing a message?

Asked by 9 years ago

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)
0
It's impossible to remove chats without a custom Chat Gui. Goulstem 8144 — 9y
0
Dang it. TypicalModerator 110 — 9y
0
You could use the emotes system to get around having others seeing your chats ImageLabel 1541 — 9y
0
It would be pretty easy to use a textbox to enter commands, rather than the chat, yeah? unmiss 337 — 9y

1 answer

Log in to vote
2
Answered by
ImageLabel 1541 Moderation Voter
9 years ago

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)
Ad

Answer this question