How does one simply detect left/right XBox Controller thumbstick movement?

local UserInputService = game:GetService("UserInputService")

local function OnInputChanged(Input, GameProcessedEvent)
    if Input.KeyCode == Enum.KeyCode.Thumbstick1 then
        print("Thumbstick 1")
        if Input.Delta.X > 0 then
            print("Right")
        elseif Input.Delta.X < 0 then
            print("Left")
        end
    elseif Input.KeyCode == Enum.KeyCode.Thumbstick2 then
        print("Thumbstick 2")
        if Input.Delta.X > 0 then
            print("Right")
        elseif Input.Delta.X < 0 then
            print("Left")
        end
    end
end

UserInputService.InputChanged:Connect(OnInputChanged)

I believe this should tell between the two thumbsticks and the direction they are moved at

4 Likes