mouse.Button1Down:Connect(function()
holdingMouse = true
while holdingMouse do
if not cooldown then
cooldown = true
barrel.Fire.Enabled = true
barrel.Flash.Enabled = true
shootTrack:Play()
sounds.FireSound:Play()
task.wait(0.1)
barrel.Fire.Enabled = false
barrel.Flash.Enabled = false
task.wait(0.5) -- Задержка перед следующей стрельбой
cooldown = false
end
end
end)
mouse.Button1Up:Connect(function()
holdingMouse = false
end)
local function playEffects()
barrel.Fire.Enabled = true
barrel.Flash.Enabled = true
shootTrack:Play()
sounds.FireSound:Play()
-- Эффекты отключаются спустя короткое время
task.delay(0.1, function()
barrel.Fire.Enabled = false
barrel.Flash.Enabled = false
end)
end
mouse.Button1Down:Connect(function()
holdingMouse = true
while holdingMouse do
if not cooldown then
cooldown = true
playEffects()
task.wait(0.5) -- Задержка перед следующей стрельбой
cooldown = false
else
task.wait(0.01) -- Короткая пауза, чтобы избежать переполнения цикла
end
end
end)
mouse.Button1Up:Connect(function()
holdingMouse = false
end)
mouse.Button1Down:Connect(function()
holdingMouse = true
while holdingMouse and not cooldown do
cooldown = true
barrel.Fire.Enabled = true
barrel.Flash.Enabled = true
shootTrack:Play()
sounds.FireSound:Play()
task.delay(0.07, function()
barrel.Fire.Enabled = false
barrel.Flash.Enabled = false
end)
task.wait(0.2)
cooldown = false
end
end)
mouse.Button1Up:Connect(function()
holdingMouse = false
end)