I want to make it so a sound plays when you say something in chat, how would I do that?
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.
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