When I hold W, the C key isn't detected

  1. What do you want to achieve? Keep it simple and clear!

Holding E begins a stance that if I keep holding E and press C, it shoots a fireball. For people who know I’m creating Jajanken: Paper.

  1. What is the issue? Include screenshots / videos if possible!

The issue is that when I hold E, and move forward(which is holding W), the UserInputService doesn’t detect when I press C. Also, it detects when move any other way without holding W(ASD, Jumping etc.).

  1. What solutions have you tried so far? Did you look for solutions on the Developer Hub?

I found solutions that had to do with detecting two keys at the same time, but they didn’t work for my problem. I tried using UIS:IsKeyDown(Enum.KeyCode.C) but it didn’t work either.

InputScript for the C button.

UIS.InputBegan:Connect(function(input, gpe)
	if gpe then return end
	if equipped == true and activated.Value == true then 
--Already checked that it wasn't the condition above
		if input.KeyCode == Enum.KeyCode.C or UIS:IsKeyDown(Enum.KeyCode.C) then
			--Code for shooting fireball here
		end
	end
end) 
1 Like

I suggest you look into contextactionservice, it’s really good for keybinds and actions like that. but if you’re looking to prevent an action when you hold down a specific key, you should consider using UserInputService:IsKeyDown() or disconnecting the event when w is pressed and reconnecting it when it’s released.

Sorry, I meant :GetKeysPressed()

So I figured out that its only the C key that isn’t detected when I hold all of the keys at the same time, do you have any idea why?

You should try checking if c is binded to another event, also, you’re checking alot of if statements, so you try printing after all of those to see if any of those are prevent the script frmo running.

Also, holding too many keys will cause other keys that are pressed to be ignored. It’s called key rollover.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.