Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How do I get an sound after sending a message in game?

Asked by 3 years ago
Edited 3 years ago

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

0
What kind of alert? Your question needs to be more specific. Sparks 534 — 3y
0
i will edit the title he means how do i play a sound if a message gets sent in game? botw_legend 502 — 3y

2 answers

Log in to vote
0
Answered by 3 years ago

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)
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 chessebuilderman 18 — 3y
0
I'm pretty sure that's not what he wanted. Dovydas1118 1495 — 3y
Ad
Log in to vote
0
Answered by
sngnn 274 Moderation Voter
3 years ago

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)

Answer this question