How do i get my timer to work for my Combo System?
I'm trying to make a combo system that resets to the initial animation it started with if the player remains idle after attacking. It would go to 1,2,3,4,5 then reset back to 1; but if you were idle and stopped at 3 it would go 1,2,3 wait and back to 1.
But the local-script I have right now doesn't reset it at all, it just keeps going with the regular cycle of 1,2,3,4,5
01 | local uis = game:GetService( "UserInputService" ) |
03 | local repstorage = game:GetService( 'ReplicatedStorage' ) |
04 | local events = repstorage:FindFirstChild( "Events" ) |
05 | local modules = repstorage:FindFirstChild( "Modules" ) |
08 | local player = game.Players.LocalPlayer |
09 | local char = player.Character or player.CharacterAdded:Wait() |
11 | repeat wait() until player:HasAppearanceLoaded() |
16 | local startTime = tick() |
29 | uis.InputBegan:Connect( function (input) |
30 | if input.UserInputType = = Enum.UserInputType.MouseButton 1 and not char:FindFirstChildOfClass( "Tool" ) and not cooldown then |
35 | if (tick() - startTime) > maxTime then |
38 | print ( "waited too long, combo reseted to first animation" ) |
42 | local hum = char:FindFirstChild( "Humanoid" ) |
44 | local a 1 = Instance.new( "Animation" ) |
45 | a 1. AnimationId = animTable [ current ] |
47 | local track = hum:LoadAnimation(a 1 ) |
51 | track.KeyframeReached:Connect( function (frame) |
52 | if frame = = "Hit" then |
53 | local part = Instance.new( "Part" ) |
57 | track.Stopped:Connect( function () |
58 | if current ~ = #animTable then |