Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How do I make it so when you say something in chat a sound will play?

Sorry I can't make a script, I know nothing on how to make a sound play when you say something in chat.

3 answers

✓ Accepted answer

Under the script is instructions on how to set it up

local Sound = workspace.Sound
function onChatted(msg, recipient, speaker) 
local playertalking = string.lower(speaker.Name) 
msg = string.lower(msg) 
local message = Instance.new("StringValue")
message.Parent = workspace
message.Value = "put the message in here"
if (msg == string.lower(message.Value)) then 
Sound:Play()
end 
end 
game.Players.ChildAdded:connect(function(plr)
plr.Chatted:connect(function(msg, recipient) onChatted(msg, recipient, plr) end) 
end)

in the quotes where it says put the message here you will put whatever the phrase or word is. You also need a sound in the workspace named Sound. Using the properties tab, you will insert your sound id. It will automatically play once this is done and the message is chatted!

if you want the sound to play any time someone chats use this:

local Sound = workspace.Sound
game.Players.PlayerAdded:Connect(function(player)
  player.Chatted:Connect(function(msg)
        Sound:Play()
  end)
end)

4 comments

0

Thanks, but how would I make it so if you say anything the sound will play?

0

I will mess with the script and let you know if I can get it to do that

0

ok that new script should make the sound play anytime someone chats

1

thanks

idk Your answer body must be at least 5 characters long. Think of more to say!

Serverscript:

game.Players.PlayerAdded:Connect(function(plr)
    plr.Chatted:Connect(function(msg)
        local sound = Instance.new("Sound")
        sound.Parent = workspace 
        sound.SoundId = "" -- Sound Id
        sound.Name = "IDK" -- Sound Name
        sound:Play()
        wait(sound.TimeLength)
        sound:Stop()
        sound:Destroy()
    end)
end)

2 comments

0

Wow You Just Copied My Awnser

0

No?

This discussion is preserved as it was. New answers, comments, and votes are closed.