Hello I’m trying to make a block that moves using Gamepad thumbstick, but I don’t know how to know how to get the thumbstick position, I saw on forum I have to see Delta.X but it didn’t work. Here the code
Code
if input.KeyCode == Enum.KeyCode.Thumbstick1 and player.PlayerGui:FindFirstChild("TowerCraneControls") then
print(input.Delta.X)
if input.Delta.X < 0 then
Action:FireServer("TurnL")
else
Action:FireServer("StopTurn")
end
end
This is how you can get the gamepad thumbstick position
local userInputService = game:GetService("UserInputService")
userInputService.InputChanged:Connect(function(input, processed)
if input.UserInputType ~= Enum.UserInputType.Gamepad1 then return end
if input.KeyCode == Enum.KeyCode.Thumbstick1 then
print("Thumbstick1", input.Position)
elseif input.KeyCode == Enum.KeyCode.Thumbstick2 then
print("Thumbstick2", input.Position)
end
end)
local userInputService = game:GetService("UserInputService")
userInputService.InputChanged:Connect(function(input, processed)
if input.UserInputType ~= Enum.UserInputType.Gamepad1 then return end
if input.KeyCode ~= Enum.KeyCode.Thumbstick1 then return end
if input.Position.X < -0.5 then print("Left") end
if input.Position.X > 0.5 then print("Right") end
end)