How do i stop a inputbegan function if a diffrent input is pressed?

Need to know how to stop a input began function if another input began is pressed

Just use a conditional statement to check if the input isn’t what you want.

1 Like

I dont know what a conditional statement is but
heres what i want to do

	UserInputService.MouseIconEnabled = false
		UserInputService.InputBegan:Connect(function(input)
	if input.KeyCode == Enum.KeyCode.E then
		character.Humanoid.Jump = true
		
	end
end)
UserInputService.InputBegan:Connect(function(input)
	if input.KeyCode == Enum.KeyCode.F then


	end
end)

basically i want it so if you press the F key the E key input began wont work anymore and sasme thing if u press the E key

you don’t need to connect it twice, if I understood you this is what you want:

F = true
E = true
UserInputService.InputBegan:Connect(function(input)
   if input.KeyCode == Enum.KeyCode.E and E == true then
      F = false --disables F
      --Do whatever
   elseif input.KeyCode == Enum.KeyCode.F and F == true then
      E = false --disables E
      --Do whatever
   end
end)
1 Like