How would I be able to make a certain sound id play (Boosting).. When I press a key(shift)?
✓ ANSWER ACCEPTED
How would you make a sound play when you press a key (Shift)?
1 answer
✓ Accepted answer
--Make sure this is a local script. Inside of backpack.
--By ChrisCoder.
local player = game.Players.LocalPlayer
local mouse = player:GetMouse()
local db = false -- debounce.
wait(2)
local sound = Instance.new("Sound", player.Character.Torso)
repeat wait() until player and player.Character
sound.SoundId = "rbxassetid://" --Your id.
mouse.KeyDown:connect(function(key)
--47 right shift, 48 left shift.
if key:btye() == "47" then
if db == false then
db = true
sound.Volume = 1
sound:Play()
wait(2) -- time until you can boost or whatever again c;
db = false
end
end
end)
--If anything is broken or dosen't work pm me.
This discussion is preserved as it was. New answers, comments, and votes are closed.

2 comments
Oh, and make sure the looped property of the sound is false.
Or just add sound.Looped = false.