How do I get an sound after sending a message in game? i need you guy help me
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)
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)