Hi, I am attempting to create a fly script for a player and am using BodyVelocity to move the player in w,a,s,d directions. I have created a user input function so that I can detect which key the player is pressing changing a variable number value and change the direction of the player by using this number to change the Velocity. The only problem is that this is a very janky and un-smooth transition between moving left and moving right, I attempted to use a tween service to smoothly make this transition so it is not as instant, by gradually increasing the variable number value but it did not work. Could someone help me on what to use for this task?
Janky un-smooth movement:
https://gyazo.com/4b09e62f2cf5fe1c91dae70720e496a1
Sample Code:
Direction = {leftForce = 0, rightForce = 0}
userInput.InputEnded:Connect(function(Input)
if Input.KeyCode == Enum.KeyCode.D then
Direction.rightForce = 1 -is put into a vector3 value later on
elseif Input.KeyCode == Enum.KeyCode.A then
Direction.leftForce = -1
end
end)