Help in making a combo effect

I want to know how to make a combo effect! Like say you continuously click, your character plays the next animation until the combo is over. And also, if the player does not click fast enough the combo restarts if you get what I mean, thanks!

2 Likes

you can make combo restart after a certain time using tick(). If you want to make a combo effect, you can simply add a number value or variable if the value or variable is 1 first combo, 2 second combo, 3 third combo and if you want the combo to be over, you can just make the value to 0 once the combo is finished.

local combo = 0
local timeUntilComboResets = 2 -- 2 seconds
local lastTimeClicked = tick() -- gets the previous time when activated the ability
script.Parent.Activated:Connect(function()
if tick() - lastTimeClicked >= timeUntilComboResets then -- checks if previous time when activated is over 2 seconds or exact
combo.Value = 0
end
lastTimeClicked = tick() -- updates time when activated ability
if combo == 0  then
combo = combo + 1
-- code
elseif combo == 1 then
combo = combo + 1
-- code
elseif combo == 2 then
combo = 0
-- code
end)

This is a simple way to make a combo effect

2 Likes