How to: Combo System

Alright so I’ve tried grasping this style but I seem to be stuck at making the Combo Number disappear when combo timer is done.

Example:

local mytab={}
local combomoves={
    [122]=true;
    [122]=function(number)
        if number==1 then
            print("Hi")
        elseif number==2 then
            print("Hey")
        elseif number==3 then
            print("Finished")
        end
    end;
    [122]=true;
    [122]=true;
    [122]=true;
}
local timer = time()
UIS.InputBegan:Connect(function(input, gpe)
    if input.UserInputType == Enum.UserInputType.Keyboard and not gpe then
        local keyPressed = input.KeyCode
        if combomoves[122] then
            if time() - timer < .5 and time() - timer > .2 then
                if #mytab < 3 then
                    timer = time()
                    table.insert(mytab,input.KeyCode)
                    local combo = #mytab
                    combomoves[122](combo)
                end
            end
        end
    end
end)

Please help me out here so I can continue and then rewrite it to look more appeasing to me. The Combo System is supposed to work like if you click or use 3 different buttons it forms a combo but only if the combo timer isn’t 0.

3 Likes

Do something like this.

if Combo < 3 then
			Combo = Combo + 1
wait(combotimer)
script.Timer:Fire() -- < Bindable event
end


script.Timer.Event:connect(function()
	wait(.3)
	if not busy then
		combo = 0
end
end)

Changed the method

Uh, I don’t think that will work… wouldn’t it just wait instead of continuing?

And what even is Timer? Fire? That’s asking for a BUNCH of output error messages, due to you’re trying to fire something nil.

Add a bindable event called timer inside the script. I should have been clearer my bad.

Then what is timer?

Oops I made a mistake it should be

script.Timer.Event

is there supposed to be a variable named timer or something?

bindable event inside of the script

Alright, let me see if this works.

There is more questions. You’re trying to use Busy which is not a global variable and should be used inside of client rather than server so that it can stop skill stacking(players using more than one abilities right after they just used one.)

Try removing that part, I thought it was something else.

Nope lol, all Busy is, is used for is a timer before other skills can be used.

but also there is one other thing that is not a global variable… that would be Combo.

1 Like

I’m just going to try using tables to make this really quick so that I don’t have to rewrite it later.

1 Like

Can’t you add the Timer.Event:Connect() under the same section as local combo

it should still work

1 Like

Can you elaborate on what this is supposed to do?

1 Like

I got it all figured out now thanks to Cetharis

2 Likes

Was it something completely different from what I posted??

1 Like

Very, He showed me the tables way which works way better. You actually have to use Byte values for keycodes for it to register better.

1 Like