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

How do I make a script that is triggered by the chat?

Asked by 4 years ago
Edited 4 years ago

I mean how it works in admin scripts for instance, you say something in the chat and a thing happens. I want to use it to open a door, but I have no idea how you do it.

1 answer

Log in to vote
0
Answered by 4 years ago

You would want to fire the Chatted event. Which is triggered via player. Here is an example code:

game.Players.PlayerAdded:Connect(function(player)

     player.Chatted:Connect(function(msg)

            print(msg)
     end)
end)

the variable msg, is what was typed by the player, and you can make the appropriate response to what the "msg" was. Example:

if msg == "Open Door" then
--open door code
end
Ad

Answer this question