I was making a little thing that plays using UserInPutService and It seems to be able to spam.
I added a debounce, however it didn't seem to work.
function onPlayerRespawned(newPlayer)
local plr = game.Players.LocalPlayer
local char = plr.Character
local torso = char:WaitForChild('Torso')
local folder = Instance.new('Folder',torso)
local sounds = {}
local soundIds = {24902512, 24902268, 24902294}
for i=1,#soundIds do
local s = Instance.new('Sound',folder)
s.SoundId = "http://www.roblox.com/asset/?id=" .. soundIds[i]
s.Volume = 1
s.Parent = script.Parent
sounds[#sounds + 1] = s
local reload = false
game:GetService("UserInputService").InputBegan:connect(function(input,proc)
if input.KeyCode == Enum.KeyCode.Q and not reload then
wait(.7)
reload = true
local i = math.random(1, #sounds)
sounds[i].Pitch = .8 + (math.random() * .2)
sounds[i]:Play()
wait(.7)
reload = false
end
end
)
end
end
function onPlayerEntered(newPlayer)
newPlayer.Changed:connect(function (property)
if (property == "Character") then
onPlayerRespawned(newPlayer)
end
end)
end
game.Players.PlayerAdded:connect(onPlayerEntered)
