Hello developer, I’m trying to make a flying script like this:
I want it to have a like tweening effect at the start of the flight and at the end of the flight, too, and also when I click the “a” and “d” the player model will face that direction. Thank you for the help!
I understand why you might think tweening is suitable. But you could also just have a Vector3 value called Vel (Stands for velocity). Using the smooth script, you can get a smooth flight.
local SMOOTHNESS = 10 --Defining smoothness (Higher means slower and smoother)
local CurrentVelocity = Vector3.new(0,10,0) --The vel will transition to this.
Vel.Value += (CurrentVelocity-Vel.Value)/SMOOTHNESS --Smooth script
Vel.Value *= 0.8 --Drag
With tweening it could be pretty much the same. But the approach I sent in the previous post is simpler to understand, and also means that you could add to the velocity to have a sort of jump. If you want tweens, you could just Tween the position of the player currently+the Vel.Value.
For tweening the velocity value, with High speed and low speeds, you would need the amount of seconds.
local HumanoidRootPart = Player.Character.HumanoidRootPart
TweenService:Create(HumanoidRootPart ,TweenInfo.new(1,Enum.EasingStyle.Elastic),{Position = HumanoidRootPart.Position + CurrentVelocity}):Play()