Elseif statement not working

I am fixing my code and realised i used uis.InputBegan:Connect(function(input, gpe) everytime when adding a new input.Keycode instead of using elseif statement after one connection so i have fixed the code but when i play i can only M1 and cant M2 or Q,E,Z,C any help? (Just a little bit of code dont want to leak the whole thing)

uis.InputBegan:Connect(function(input, gpe)
if gpe then return end
if input.UserInputType == Enum.UserInputType.MouseButton1 and tick() - LastTimeM1 > .3 and tick() - LastM1End > .7 then
if tick() - LastTimeM1 > .7 then
combo = 1

		LastTimeM1 = tick()

		local animation = Instance.new("Animation", workspace.Fx)

		animation.AnimationId = JabAnim[combo]

		local load = humanoid.Animator:LoadAnimation(animation)
		load:Play()

		animation:Destroy()

		local hitTarg = hb(Vector3.new(4,6,4), character.PrimaryPart.CFrame * CFrame.new(0,0,-3), {character}, character)

		if hitTarg then
			local data = {
				["Target"] = hitTarg,
				["Character"] = character,
				["Combo"] = combo,
				["Action"] = "M1"
			}

			remote:FireServer(data)
		end
		if combo == #JabAnim then
			combo = 1
			LastM1End = tick()
		else
			combo += 1
			

		end
		
	elseif input.UserInputType == Enum.UserInputType.MouseButton2 and tick() - LastTimeM2 > .3 and tick() - LastM2End > .7 then
		if tick() - LastTimeM2 > .7 then
			combo = 1
		end

if input.UserInputType == Enum.UserInputType.MouseButton1 and tick() - LastTimeM1 > .3 and tick() - LastM1End > .7 then
if tick() - LastTimeM1 > .7 then
combo = 1

you forgot the end for the second if maybe ? cause i didnt saw any end for it just put an end here and try

if combo == #JabAnim then
			combo = 1
			LastM1End = tick()
		else
			combo += 1
			

		end
       end -- add an end here and try it hope it works
```

it has no issues w the end bcz if i add another end there then it shows i have a issue its prob something wrong w the ifstatement

and i didnt put the whole script there just a snippet