I’m trying to detect the joystick’s direction for UI in my game. Read a few posts about it and tried what was marked as the solutions. Tested it on my Switch pro controller, and it didn’t work.
local function InputFunc(Input,GPE)
if GPE then
return end
print(Input.KeyCode)
if Input.KeyCode == Enum.KeyCode.Thumbstick1 then
print("ThumbStick1 Detected")
print(Input.Position.X,Input.Position.Y)
end
end
UIS.InputBegan:Connect(InputFunc)
That absolutely works! Another problem though is that my right thumbstick is drifting like crazy… even when i seem to stop it, it seems to be doing it but just very slowly. Can’t do any other inputs because of it apparently… gotta figure out how to fix that
--!strict
local UserInputService = game:GetService("UserInputService")
local DEADZONE: number = 0.1 -- 0-1
UserInputService.InputChanged:Connect(function(input: InputObject, gameProcessedEvent: boolean): ()
if gameProcessedEvent then
return
end
if input.KeyCode == Enum.KeyCode.Thumbstick1 and input.Position.Magnitude > DEADZONE then
print("InputChanged without drifting")
end
end)
OK all of a sudden it just stops reading inputs from my left joystick at all. Any ideas around it, or do you think it’s my controller? Cuz I think it’s the latter.
I can still move around, turn my camera around ingame but I can’t get it to read the inputs.
Of course it still reads from the right joystick though…
Depends on what your code looks like. If you cannot move and you’re merely using InputBegan, then it’s probably your controller if there is no other code interference.
local function InputFunc(Input,GPE)
if GPE then
return end
local DEADZONE = 0.1
if Input.KeyCode == Enum.KeyCode.Thumbstick1 then
print(Input.Position.X,Input.Position.Y,Input.KeyCode)
elseif Input.KeyCode == Enum.KeyCode.Thumbstick2 and Input.Position.Magnitude > DEADZONE then
print(Input.Position.X,Input.Position.Y,Input.KeyCode)
end
end
UIS.InputChanged:Connect(InputFunc)
I tried checking if the left thumbstick somehow couldn’t get past the deadzone, but no it just doesn’t input whatsoever. Probably the controller, I’ll try recalibrating it soon.
Funnily enough, I also test all my gamepad code with a Switch Controller. Since it is not natively supported on Windows, I use BetterJoy as my controller drivers. Although very buggy, if you are using custom drivers, try running it on Administrator mode and see if that helps.
Unfortunately this is just issues with Windows and/or the drivers themselves, not a Roblox issue, so this thread should remain closed. Feel free to DM me details and I might be able to help.