Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How do i get my timer to work for my Combo System?

Asked by
rexpex 45
5 years ago

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

01local uis = game:GetService("UserInputService")
02 
03local repstorage = game:GetService('ReplicatedStorage')
04    local events  = repstorage:FindFirstChild("Events")
05    local modules = repstorage:FindFirstChild("Modules")
06 
07 
08local player = game.Players.LocalPlayer
09    local char = player.Character or player.CharacterAdded:Wait()
10 
11repeat wait() until player:HasAppearanceLoaded()
12 
13local current  = 1
14local cooldown = false
15 
View all 70 lines...
0
Are you using a loop? and maybe try setting Line 67 to 0 instead of false aj44000 2 — 5y
0
Im not using a loop, also cooldown is a boolean for my debounce that dictates whether a player can hit again; so, i cant set that to 0 rexpex 45 — 5y

1 answer

Log in to vote
1
Answered by 5 years ago
Edited 5 years ago

In your spawn() function, you don't have a loop to constantly check to see if it needs to reset their current combo. So it'll run a single time once you spawn the function, and of course since it's running only once as soon as you spawn the function, the passed time won't be passed your maxTime

With that being said, this should fix your problem

01local uis = game:GetService("UserInputService")
02 
03local runservice = game:GetService("RunService");
04 
05local repstorage = game:GetService('ReplicatedStorage')
06local events  = repstorage:FindFirstChild("Events")
07local modules = repstorage:FindFirstChild("Modules")
08 
09 
10local player = game.Players.LocalPlayer
11    local char = player.Character or player.CharacterAdded:Wait()
12 
13repeat wait() until player:HasAppearanceLoaded()
14 
15local current  = 1
View all 74 lines...
0
Thanks a lot, worked like a charm rexpex 45 — 5y
Ad

Answer this question