I have tried to make a combo system to where if you press "Q-E-Q" In enough time to you'll do a combo, but I have no idea if I am doing it correctly. Can I get a little hand?
userinputservice.InputBegan:Connect(function(input, gpe) if gpe then return end; if input.KeyCode == Enum.KeyCode.Q then if transforming or kiblasting or evading == true then return end; if not attacking then attacking = true if tick()-attack_timer > 0.8 then attackstate = 0 attacking = false end attack_timer = tick() attackstate = attackstate+1 print("Punch 1") end if input.KeyCode == Enum.KeyCode.E and attackstate == 1 then print("Kick 1") attackstate = 0 end end end)
This should work, its the same one i use:
local UIS = game:GetService("UserInputService") UIS.InputBegan:Connect(function(key) table.insert(keys, {key, tick()}) if tick() - keys[#keys - 2][2] < 1 then if keys[#keys - 2][1].KeyCode == Enum.KeyCode.E then if keys[#keys - 1][1].KeyCode == Enum.KeyCode.E then if keys[#keys][1].KeyCode == Enum.KeyCode.Q then --Combo print("Worked") end end end end end)
Any errors, feel free to comment