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

How do I make it so when say something in chat a sound plays?

I want to make it so a sound plays when you say something in chat, how would I do that?

2 comments

0

Not a request site.

0

@JailBreaker_13 I recommend you look at the guidelines again, this falls under concept request because he is not asking for a script, only an explanation.

2 answers

This Script Is Server Sided Meaning That It Will Work For Every Client In Game Not Just For The Local Client:

game.Players.PlayerAdded:Connect(function(plr) -- Player Added Event
	plr.Chatted:Connect(function(msg) -- Chatted Event
		local sound = Instance.new("Sound") -- Make New Sound
		sound.Parent = workspace -- Parent Of The Sound
		sound.SoundId = "" -- Sound Id Make Sure To Put rbxassetid:// Or It Won't Work!
		sound.Name = "IDK" -- Sound Name
		sound:Play() -- Play The Sound
		wait(sound.TimeLength) -- Wait Until The Song Finished
		sound:Stop() -- Stop It Playing
		sound:remove() -- Remove It
	end) -- End The Function
end) -- End The Function

I Hope I Was More Clear Here Sorry That I Didn't Explain That Well I Was On My Phone.

1 comment

0

If you give an answer, you have to explain. 

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)

That is the serverscript

1 comment

0

You can't copy and paste someone's answer to try to farm karma. The only case when you should be doing that is if the other person didn't provide an explanation with their post, yet you also did not provide an explanation.

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