How to play a sound when saying a specific word in chat

Hello everyone! Today i will show you how to play a sound when you type a set word, so let’s begin!

So first make a folder in ServerScriptService and name it “Chat Sounds”, then insert a script. Now type this in the script:

game.Players.PlayerAdded:Connect(function(player)
  player.Chatted:Connect(function(msg)
  end)
end)

Now we need to set the word, it can be anything you want. For this tutorial, i’ll be using Bruh.

So add that to the script:

game.Players.PlayerAdded:Connect(function(player)
  player.Chatted:Connect(function(msg)
  if msg == "bruh" then
  end)
end)

Alright, so we now need a sound. You can either create one or get one from the audio section of the toolbox. I’m not gonna show how to make a sound, but there are tutorials for making sounds.

So let’s say you got/created a sound, you wanna copy it’s id. Now insert a sound in Workspace (You can name the sound what you want, but i won’t rename it for this tutorial) and go to the Properties tab, select soundId and paste the id. Now let’s go back to the script.

Now we want to make the sound play when a player has said that word, so you need to add:

game.Players.PlayerAdded:Connect(function(player)
  player.Chatted:Connect(function(msg)
  if msg == "bruh" then
    workspace.Sound:Play()
     end
  end)
end)

And we are done, you can test your game and type the word you set in line 3 (the if then statement) and it should play the sound.

Thanks for reading and bye!!

7 Likes

its good for beginners I guess. But what could be better… or nevermind that might be rlly hard even for me! Making a system that fixed the bad grammer of every player

1 Like

Okay that actually is a really cool Idea! I would love to see something like that!

I did found a website but as i dont have a company yet I cant “Get Started” on it. Its called Ginger

Sorry but I don’t follow. Does this website allow you to make a grammar fixing system?

ya

Ah I see. That’s interesting. I would love to see that in effect! I might look into it later!