Any idea why userinputservice wont work?

uis.InputBegan:Connect(function(input, gameProcessedEvent)
	if input.UserInputType == Enum.UserInputType.Keyboard then
		if input.KeyCode == Enum.KeyCode.C then
			--Anim(animations[1])
		
		
		elseif input.KeyCode == Enum.KeyCode.LeftShift then
				hum.WalkSpeed = 160
		print("shift")	
		
		
		elseif input.KeyCode == Enum.KeyCode.One or Enum.KeyCode.Two or Enum.KeyCode.Three then
			--Anim(animations[3])
			
		end
		print("gahhhhhhhhhhh")
	end
	
end)

i have tried alot idk what the prob is

local debounce = false
uis.InputBegan:Connect(function(input, gameProcessedEvent)
if gameProcessedEvent then return end
	if input.UserInputType == Enum.UserInputType.Keyboard then
		if input.KeyCode == Enum.KeyCode.C and debounce == false then
debounce = true
-- put whatever animation you had here
wait(2) -- to make it so people can't just spam C
debounce = false

the problem I saw was that there was no debounce just try and work a debounce in your script and it should work

ooooohhh ill try this tyvm​:+1::+1::+1::+1::+1::+1:

What do you mean it doesn’t work? Where does it get to? Does it print anything? If not, add more prints and check again. It’s this a LocalScript?

if it doesn’t work could you post the whole script I want to see what you have

One of your issues is here. You must redefine what you’re looking for between each “or”.

Change it to this:

elseif input.KeyCode == Enum.KeyCode.One or input.KeyCode == Enum.KeyCode.Two or input.KeyCode ==  Enum.KeyCode.Three then
	--Anim(animations[3])
end
1 Like

its a local nd doesnt peint at allllll

try this

uis.InputBegan:Connect(function(input, gameProcessedEvent)
	if gameProcessedEvent then return end
	
	if input.UserInputType == Enum.UserInputType.Keyboard then
		if input.KeyCode == Enum.KeyCode.C then
			--Anim(animations[1])
			print("c")
			
		end
		if input.KeyCode == Enum.KeyCode.LeftShift then --Will only work if shift lock is off, consider LeftControl
			hum.WalkSpeed = 160
			print("shift")	

		end
		if input.KeyCode == Enum.KeyCode.One or input.KeyCode == Enum.KeyCode.Two or input.KeyCode == Enum.KeyCode.Three then
			--Anim(animations[3])
			print("onetwothree")
			
		end
	end

end)

thanks ill try this later, i just logged off

1 Like

The issue was that i didnt have api services enabled my bad

2 Likes