How would I wait in the chat for someone to say, for example "Pie is cool!".
.Chatted event is what detects chat. However, you'll need to connect it to everyone:
Normal script in ServerScriptService:
01 | function newPlayer(p) |
02 | p.Chatted:connect( function (msg) |
03 | if msg = = "Pie is cool!" then |
04 | -- Stuff you want to happen (use p to reference the player who said it) |
05 | end |
06 | end ) |
07 | end |
08 | game.Players.PlayerAdded:connect(newPlayer) |
09 | for _,v in pairs (game.Players:GetPlayers()) do |
10 | newPlayer(v) |
11 | end |
1 | game.Players.PlayerAdded:connect( function (player) |
2 | player.Chatted:connect( function (msg) |
3 | if msg = = "Pie is cool!" then |
4 | print (player.Name.. " chatted \"Pie is cool!\"" ) |
5 | end |
6 | end ) |
7 | end ) |
The Chatted event listens to everything a player says.