How to detect controller joystick position

Original source:

I’m trying to detect the position of the player’s joystick on an xbox controller, and which joystick is being used (left or right joystick)
I looked at the post above and it doesn’t work for whatever reason

game:GetService("UserInputService").InputBegan:Connect(function(input, process)
	if input.KeyCode and not process then
		print(input.KeyCode)
	end
	
	if input.Position then
		print(input.Position.Magnitude)
	end
end)

It should print the name of any input, and also the position of the input (if it has a position)
The post I’m referencing says you can get the magnitude of the position, but it’s not printing anything when I move the joystick around

1 Like

there is a Enum key for both of the ThumbSticks

if input.KeyCode == Enum.KeyCode.Thumbstick1 then
print("ThumbStick1 Detected")
-- Position
print(input.Position.X,input.Position.Y)

X is pointing to right -X pointing to left
Y pointing to up -Y pointing to down

3 Likes