Each time you hit, or do a M1 i want to slow the character for like 1 second, but if i just make it like:
Humanoid.WalkSpeed = 4
task.wait(1)
Humanoid.WalkSpeed = 16
That wouldnt work, i want to reset the countdown from 1 to 0 each time you click.
This is the code i have for now:
if info.Key == Enum.UserInputType.MouseButton1 then
if sf.SetCooldown({plr = player, ability = "Punch", check = true}) then return end
if collectionService:HasTag(character, "attackEnd") then return end
sf.SetCooldown({plr = player, ability = "Punch", dura = .3})
Attacking = true
task.delay(1,function()
Attacking = false
end)
if Combo.Value >= 5 then
collectionService:AddTag(character, "attackEnd")
Combo.Value = 0
--pause after full combo--
task.delay(1.5, function()
collectionService:RemoveTag(character, "attackEnd")
end)
return
end
if tick()-Lastm1.Value > 2 then
Combo.Value = 0
end
Lastm1.Value = tick()
Combo.Value += 1
print(Combo.Value)
--play animation--
Engine:FireClient(player, "LoadAnim", {Animation = repStorage.Animations:FindFirstChild("Combo"..Combo.Value), human = human})
end
In this part:
Attacking = true
task.delay(1,function()
Attacking = false
end)
I wanted to try and check if attacking is true, if it is slow the character for one second, but i cant see how i can do that