Ad
Still have questions? Join our Discord server and get real time help.
Log in to vote
2

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

Asked by 4 months ago

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

Log in to vote
0
Answered by 4 months ago
Edited 4 months ago

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)
0
Thanks, but how would I make it so if you say anything the sound will play? RenDevelopment 15 — 4mo
0
I will mess with the script and let you know if I can get it to do that peytonallen920 66 — 4mo
0
ok that new script should make the sound play anytime someone chats peytonallen920 66 — 4mo
1
thanks RenDevelopment 15 — 4mo
Ad
Log in to vote
0
Answered by 4 months ago

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

Log in to vote
-1
Answered by 4 months ago

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)
0
Wow You Just Copied My Awnser Harry_TheKing1 180 — 4mo
0
No? Official_DuckyYT 55 — 4mo

Answer this question