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

How to make a script activate by saying a chat message?

Asked by 6 years ago

So, I'm making my own computer core and I wanted to know something. I really need help making an System that activates a script or changes something by saying something in chat. Like if you do the following "Computer! Activate Lockdown" then the lockdown script will activate. But first it needs to verify that it is ME saying and not another player. How do you do that? "PS: This is not an request: I'm just asking a question"

1 answer

Log in to vote
0
Answered by 6 years ago
Edited 6 years ago

The basic code to do something similar to what you want would be this:

game.Players.PlayerAdded:connect(function(player)
    if player.Name == "kyanoke11" then
        player.Chatted:Connect(function(msg)
            if msg == "Example" then
                -- Code executed after the specific user has said "Example" on chat.
            end
end)
    end
end)

Remember that if you want to filter more people you could use an actual table.

Refference link: http://wiki.roblox.com/index.php?title=API:Class/Player/Chatted

Hope this helped you!

0
Thank you!!!. kyanoke11 15 — 6y
0
No problem. iDarkGames 483 — 6y
Ad

Answer this question