Trying to make a combat system, but i find that when i spam m1 instead of the animation ending and the other animation starting, it bugs out and they both try and run or only 1 or 2 run and the rest dont
function Fists.LightAttack(character : Model, count : number)
local humanoid = character.Humanoid
local hrp = character.HumanoidRootPart
local bindableEvent = SS.Events.CombatFinished
local animator = humanoid:FindFirstChildOfClass("Animator") :: Animator
if not animator then
animator = Instance.new("Animator")
animator.Parent = humanoid
end
if count == 1 then
local track = animator:LoadAnimation(animations[count])
track:GetMarkerReachedSignal("AttackEnded"):Connect(function()
track:Stop()
bindableEvent:Fire(character)
end)
track:Play()
elseif count == 2 then
local track = animator:LoadAnimation(animations[count])
track:GetMarkerReachedSignal("AttackEnded"):Connect(function()
track:Stop()
bindableEvent:Fire(character)
end)
track:Play()
elseif count == 3 then
local track = animator:LoadAnimation(animations[count])
track:GetMarkerReachedSignal("AttackEnded"):Connect(function()
track:Stop()
bindableEvent:Fire(character)
end)
track:Play()
elseif count == 4 then
local track = animator:LoadAnimation(animations[count])
track:GetMarkerReachedSignal("AttackEnded"):Connect(function()
track:Stop()
bindableEvent:Fire(character)
end)
track:Play()
end