Mail.ruПочтаМой МирОдноклассникиВКонтактеИгрыЗнакомстваНовостиКалендарьОблакоЗаметкиВсе проекты

Помогите со скриптом Roblox Studio

Дед Ученик (225), на голосовании 19 часов назад
Я делаю свою систему оружия и столкнулся с проблемой с эффектами, они просто не успевают пропадать, у меня сделано так:
 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.wait(.1)
cooldown = false
barrel.Fire.Enabled = false
barrel.Flash.Enabled = false
end
end)
Если поможете буду благодарен
Голосование за лучший ответ
ilyhaisgood Профи (520) 1 месяц назад
 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)
AlexKurov Мыслитель (9313) 1 месяц назад
 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)
S.H.I. Оракул (71445) 1 месяц назад
 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)
Похожие вопросы