[SOLVED] problems with a UIS code

My script:

user_input_service.InputBegan:connect(function(input)
	
	
	if input.KeyCode == Enum.KeyCode.LeftControl or Enum.KeyCode.RightControl then


		load_animation_1:Play()


	end
	
	
end)


user_input_service.InputEnded:connect(function(input)


	if input.KeyCode == Enum.KeyCode.LeftControl or Enum.KeyCode.RightControl then


		load_animation_1:Stop()


	end


end)

the click bug again…

Thanks for reading, TinkyWinkyDev.

I didnt used the ‘else’ so, theres something wrong.

I don’t understand, what exactly is the problem?

1 Like

When i click, i crouch. I remember see this bug in other script by me, but it was a else problem. Here is not a else problem, so… I dont know what happened here.

I send the wrong script sorry, better you read again.

Does it work, if you change :connect() to :Connect()?

1 Like

No, theres nothing wrong with :connect(), you can use :Connect() and :connect().

Is there anything in the output?

1 Like

Change

or Enum.KeyCode.RightControl

to

or input.KeyCode == Enum.KeyCode.RightControl

Edit: when you use “or Enum.KeyCode.RightControl”, it will check if RightControl exists in the KeyCode Enum and it always does. If you use “or input.KeyCode == Enum.KeyCode.RightControl” it will check if the ended input is the RightControl.

1 Like

So what is the problem with clicking and crouching? Please specifically tell us what the problem is.

Edit: Please show us the entire script, of everything relating to that piece of code.

1 Like

Thanks for helping me.

dwaoiundoasdmnowamosmdwoams ← this is for ‘post must be at least (number) characters’

If my solution, was, in fact, correct, I would be grateful if you marked it as the solution.

1 Like

It already helped and is correct, thanks.