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 get an sound after sending a message in game?

How do I get an sound after sending a message in game? i need you guy help me

2 comments

0

What kind of alert? Your question needs to be more specific.

0

i will edit the title he means how do i play a sound if a message gets sent in game?

2 answers

✓ Accepted answer

This is basic, here is an example I made:



local tps = game:GetService("TeleportService")
game.Players.PlayerAdded:Connect(function(plr)
	plr.Chatted:Connect(function(msg)
		if msg == "/apply" then
			tps:Teleport(PLACE_ID_HERE, plr)
		end
		
		
	end)
	
	
end)

2 comments

0

You can do a lot with the message function. More about it here.https://developer.roblox.com/en-us/api-reference/event/Player/Chatted

0

I'm pretty sure that's not what he wanted.

First, you'd need to get the player. Then, you need to insert a sound and set its properties to how you want.

(Make a variable for both the player and the sound.)

local sound = game.SoundService.Sound
local player = player

Then, use player.Chatted to detect when the player chats.

player.Chatted:Connect(function()

Inside of that, make the sound play using sound:Play()

player.Chatted:Connect(function()
	sound:Play()
end)

Full example:

local sound = game.SoundService.Sound
local player = player

player.Chatted:Connect(function()
	sound:Play()
end)

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