Trying to make the animations play over once they are all over
Animatons load fine but after it finishes all the animations, when I click again it doesn’t fire
tried reworking the scripts but no results
--
local CAS = game:GetService("ContextActionService")
-----------------------------------------------
local PunchCount = 0
local Debouncey = false
local FightAnimation = function()
if Debouncey then return end
if PunchCount > 3 then
PunchCount = 0
--------------
else
PunchCount = PunchCount + 1
print(PunchCount)
end
local Character = game.Players.LocalPlayer.Characterocal Character = game.Players.LocalPlayer.Character
Debouncey = true
----------------------------------------------------
local RightPunch = game.ReplicatedStorage.RightPunch
local LeftPunch = game.ReplicatedStorage.LeftPunch
local Kick = game.ReplicatedStorage.KickAnimation
---------------------------------------------------
local RightPunchAnimation = Character.Humanoid.Animator:LoadAnimation(RightPunch)
local LeftPunchAnimation = Character.Humanoid.Animator:LoadAnimation(LeftPunch)
local KickAnimation = Character.Humanoid.Animator:LoadAnimation(Kick)
--------------------------------------------------------------------------------
if PunchCount == 1 then
RightPunchAnimation:Play()
task.wait(.4)
Debouncey = false
elseif PunchCount == 2 then
LeftPunchAnimation:Play()
task.wait(.4)
Debouncey = false
elseif PunchCount == 3 then
KickAnimation:Play()
task.wait(.4)
Debouncey = false
end
end
CAS:BindAction("FightAnimation",FightAnimation,false,Enum.UserInputType.MouseButton1)
You’re adding 1 to your punch count even when your count is 3. Because of this, the debounce is set to true and never meets any condition to become false again.
Try adding to the count before checking the number.
if PunchCount >= 3 then
PunchCount = 0
else
PunchCount += 1
end
print(PunchCount)
local Character = game.Players.LocalPlayer.Character or game.Players.LocalPlayer.CharacterAdded:Wait()
try this? I’m not entirely sure what the issue could be aside from the punchcount portion