if StaminaValue.Value == 0 then return end
tool.Activated:connect(function()
if humanoid and humanoid.Health > 0 then
if Swing1Play.Value ~= true then
Swing1Play.Value = true
StaminaValue.Value = StaminaValue.Value - 5
playSwing1 = humanoid:LoadAnimation(swing1)
playSwing1:Play()
swooshSound:Play()
wait(.7)
Swing2Play.Value = false
tool.Activated:connect(function()
if humanoid and humanoid.Health > 0 then
if Swing2Play.Value ~= true and playSwing1 then
Swing2Play.Value = true
StaminaValue.Value = StaminaValue.Value - 5
playSwing2 = humanoid:LoadAnimation(swing2)
playSwing2:Play()
swooshSound:Play()
wait(.7)
Swing3Play.Value = false
tool.Activated:connect(function()
if humanoid and humanoid.Health > 0 then
if Swing3Play.Value ~= true and playSwing2 then
Swing3Play.Value = true
StaminaValue.Value = StaminaValue.Value - 5
playSwing3 = humanoid:LoadAnimation(swing3)
playSwing3:Play()
swooshSound:Play()
wait(.7)
Swing4Play.Value = false
tool.Activated:connect(function()
if humanoid and humanoid.Health > 0 then
if Swing4Play.Value ~= true and playSwing3 then
Swing4Play.Value = true
StaminaValue.Value = StaminaValue.Value - 5
playSwing4 = humanoid:LoadAnimation(swing4)
playSwing4:Play()
swooshSound:Play()
wait(.7)
Swing1Play.Value = false
end
end
end)
end
end
end)
end
end
end)
end
end
end)
COMMUNITY QUESTION
How do i stop this activated function from running unless a certain condition is met?
0 answers
No public answers were preserved for this question.
This discussion is preserved as it was. New answers, comments, and votes are closed.

3 comments
Be more specific with what you're asking. What condition?
lets say if the value of stamina is less than 0
Replace the ' == 0' with '<= 0'. '<=' means less than or equal to. In the future, please explain what you're asking in the question.