So it involves getting the x and y of the joystick. If I push my left stick to some direction, then quickly let go, the last time it updates is not 0, or when I let go, the final value in the console log is not 0, which means that if I push the stick and let go, my drone would still move even though the joystick is in the center.
Can you provide any scripts or snippets on where you are grabbing the Controllers X and Y
Also could be stick drift…?
I’m sure you can tell when I let go of the joystick. When I do, the value should be 0, but it doesn’t update fast enough.
I see. Can you give me some code to work with?
Sorry I forgot to provide basically everything lol
local lx,ly local rx,ry uis.InputChanged:Connect(function(input, processed) if input.UserInputType == Enum.UserInputType.Gamepad1 then if input.KeyCode == Enum.KeyCode.Thumbstick1 then lx = input.Position.X ly = input.Position.Y end if input.KeyCode == Enum.KeyCode.Thumbstick2 then rx = input.Position.X ry = input.Position.Y end end end)
Looking at this looks fine. Are you sure the controller doesnt have some sort of tiny drift? If you are sure ill test it out myself.
Nah it doesn’t drift. I forgot to mention that if I very slowly release the joystick to the center, the last value is pretty close to 0.
Testing it now and I dont think it will equal to exactly “Zero” what you can do tho is string.format it
local lx,ly local rx,ry local decimalPlaces = 2 function RoundNumber(num) return string.format("%."..decimalPlaces.."f", num) end game.UserInputService.InputChanged:Connect(function(input, processed) print("Sasas") if input.UserInputType == Enum.UserInputType.Gamepad1 then if input.KeyCode == Enum.KeyCode.Thumbstick1 then lx = RoundNumber(input.Position.X) ly = RoundNumber(input.Position.Y) print(lx .. " / " .. ly) end if input.KeyCode == Enum.KeyCode.Thumbstick2 then rx = RoundNumber(input.Position.X) ry = RoundNumber(input.Position.Y) print(rx .. " / " .. ry) end end end)
I have only been able to get 0 a couple times by flicking my joystick. I think this is a roblox issue.
Uhh this didn’t seem to do much as it still doesn’t end in 0.
local decimalPlaces = 2 to
local decimalPlaces = 1
Like I said you arent going to get exactly zero. Leaving it at
2 (if you are calculating with speed) is your best bet.
Now it usually ends in 0.1, but there’s a chance it could even go up to 0.4.
I am not entirely sure. This is on roblox’s end is what I am going to believe
You aren’t supposed to use the input changed function for all I know.
Though, I’m unaware of an alternative.