Thumbsticks not changing InputType to Gamepad?

So for my game, I have a GUI that changes the graphic to show the B button (for controllers) or the F key (for keyboard) when it detects the gamepad or the keyboard. It all works fine, except using the thumbsticks don’t change the input type.

Here’s the code I have for it:

USP.InputBegan:Connect(function(input,gameProcessed)
	if input.UserInputType == Enum.UserInputType.Gamepad1 then
		pointergui.ImageLabel.Image = "rbxassetid://2953057618"
	elseif input.KeyCode == Enum.KeyCode.Thumbstick1 then
		pointergui.ImageLabel.Image = "rbxassetid://2953057618"
	elseif input.KeyCode == Enum.KeyCode.Thumbstick2 then
		pointergui.ImageLabel.Image = "rbxassetid://2953057618"	
	elseif input.UserInputType == Enum.UserInputType.Keyboard then
		pointergui.ImageLabel.Image = "rbxassetid://2963841728"	
	end
end)

Neither the Gamepad1 or Thumbstick lines are detecting or changing, is there a reason for this?

I think having Gamepad1 over Thumbstick1 or Thumbstick2 would cause it to not detect that (as it would fall into the gamepad check first) - so that may be one thing. Otherwise, try logging out what the UserInputType and KeyCode are and see if it’s getting any weird values

I don’t think that’s it. Keyboard is under and it detects just fine, and the thumbstick values didn’t detect alone, and Gamepad1 didn’t detect the thumbsticks (hence them being below)

Keyboard would be separate though - Thumbsticks would be by using the gamepad controller, so you’d have both the Thumbsticks & the Gamepad itself as true statements in that case (at least, you should have it like that)

What controller are you using? I’ve had problems with it detecting PS4 in the past. That may be it. Not sure why else it wouldn’t be working

I’m using a PDP Xbox One controller. Other games with stuff like this (mainly Super Bomb Survival) work perfectly fine, and like I said the thumbstick arguments were added later because it wasn’t detecting them anyway.

I think you have to use InputChanged instead of InputBegan if you want to detect thumbsticks.

2 Likes

Changing it to InputChanged seems to have made it not do anything sadly.

Use InputBegan to detect Gamepad1. Use InputChanged to detect the thumbsticks.

game:GetService("UserInputService").InputBegan:Connect(function(inputObject, processed)
	if inputObject.UserInputType == Enum.UserInputType.Gamepad1 then
		print("gamepad")
	end
end)

game:GetService("UserInputService").InputChanged:Connect(function(inputObject, processed)
	if inputObject.KeyCode == Enum.KeyCode.Thumbstick1 then
		print("moving 1")
	elseif inputObject.KeyCode == Enum.KeyCode.Thumbstick2 then
		print("moving 2")
	end
end)
1 Like

it worked, thank you!