INFORMATION: I was making a left and right mouse button hand-to-hand combat system, but I've hit a stump that i need help solving.
PROBLEM: I wanted to make it where if you press the left button four times than the right button quick enough, it would do a special action, but when I test it out, nothing happens.
CODE:
UserInputService.InputBegan:Connect(function(Input, Processed) if Processed then return end if Input.UserInputType == Enum.UserInputType.MouseButton1 then -- Light Attack if not Attacking then Attacking = true Action = "Light Attack" if Airborn == true then print("Air Cancel") -- Stuff else print("Light Attack") -- Normal Function if tick()-Timer > 1 then L_Combo = 0 H_Combo = 0 Action = "" end L_Combo = L_Combo + 1 -- Combo Function if H_Combo == 3 and L_Combo == 1 then print("Kick Away") H_Combo = 0 L_Combo = 0 end --[[ local Animation = Humanoid:LoadAnimation(Animations["L_Attack"..L_Combo]) Animation:Play() Events["Attack"]:InvokeServer(Action) --]] if L_Combo >= 5 then L_Combo = 0 end end wait(0.4) Attacking = false Action = "" end elseif Input.UserInputType == Enum.UserInputType.MouseButton2 then -- Heavy Attack if not Attacking then Attacking = true Action = "Heavy Attack" if Airborn == true then print("Downward Kick") -- Stuff else print("Heavy Attack") -- Normal Function if tick()-Timer > 1 then L_Combo = 0 H_Combo = 0 Action = "" end H_Combo = H_Combo + 1 -- Combo Function if L_Combo == 4 and H_Combo == 1 then print("Launcher") H_Combo = 0 L_Combo = 0 end --[[ local Animation = Humanoid:LoadAnimation(Animations["H_Attack"..H_Combo]) Animation:Play() Events["Attack"]:InvokeServer(Action) --]] if H_Combo >= 4 then H_Combo = 0 end end wait(0.5) Attacking = false Action = "" end end end)
Can I get some assistance on solving this?
local player = game.Players.LocalPlayer local mouse = player:GetMouse() local counter = 0 mouse.Button1Down:connect(function() counter = counter + 1 if counter - 1 == 0 then wait(1) counter = 0 end end) mouse.Button2Down:connect(function() if counter >= 4 then counter = 0 print("yey") -- play cool combo here end end) while wait() do print(counter) end
here try that; it will print("yey") after 4 mouse button1down() and 1 mouse button2down() pressed within a second, in that specific order; place in starterpack