I’ve a function which allows xbox users to drive:
local function XboxDirection(Input, GameProcessedEvent)
if Input.KeyCode == Enum.KeyCode.Thumbstick1 then
if Input.Delta.X > 0 then
if not CurrentForce then CurrentForce = Vector3.new(0,0,0) end
CurrentAngle = Vector3.new(0,-1,0) * 2
elseif Input.Delta.X < 0 then
if not CurrentForce then CurrentForce = Vector3.new(0,0,0) end
CurrentAngle = Vector3.new(0,1,0) * 2
end
if Input.Delta.Y > 0.1 then
if not CurrentAngle then CurrentAngle = Vector3.new(0,0,0) end
CurrentForce = Vector3.new(-1,0,0)
print("forward")
elseif Input.Delta.Y < -0.1 then
if not CurrentAngle then CurrentAngle = Vector3.new(0,0,0) end
CurrentForce = Vector3.new(1,0,0)
print("backward")
elseif Input.Delta.Y > -0.1 or Input.Delta.Y < 0.1 then
if not CurrentAngle then CurrentAngle = Vector3.new(0,0,0) end
CurrentForce = Vector3.new(0,0,0)
print("stop")
end
end
end
However, Since this is tied to inputchanged, There’s a slight problem. when the thumbstick is moved fordward, It prints forward then goes straight back to stop, So to me it seems that the delta value goes back straight to 0 after.
Also, Even when the thumbstick is idle, and no inputs are being used, it still prints “stop” indicating that the input has been changed
Does anyone have any ideas on how to fix this?