How to make LinearVelocity goes to a position and stops there

Hello i was wanting make achieve something like if a person touched a part will go to a part ( kinda similar to teleport) but with linear velocity fly to that part and stop.

Making simple as possible i just want to achieve: There is green part but its doesnt matter where it (Green Part) always go to yellow part with LinearVelocity

I searched in Devforum and Youtube but i dont found any help for that
(btw this is my first topic)

Ok but first off why linear velocity specifically?
You should use tweening in such cases ideally.

2 Likes

Thank you so much i didnt even know TweeningService - I guess i will watch some tutorials about Services

Btw do i need do anything when i got Solution

Well i could give u a tutorial hjere as im bored rn.

So first lets understand something known as linear interpolation.this is simplified as lerp.this simply means to move a thing smoothly from one point to another.

Tweening is one of the way we move things.it was initially used to make GUIs move.then it expanded to everything. Now ik that lerping sounds like its hard but it isnt actually,Atleast on roblox. So let me explain you something know as

TweenService.

local TweenService = game:GetService("TweenService")

Ok? But what do i do withh it?

You can create a Tween.this basically stores movement info.

TweenService:Create()

First i want you to try it on a part. We will move it 10 studs on x axis.

So we fill the first parameter as Part

TweenService:Create(workspace.Part)

Next we will define something known as tweenInfo

This basically tells how long a tween has to be played and what way does it move throughout the tween.

local TweenInfo = TweenInfo.new(
1 --Duration of tween in seconds
,Enum.EasingStyle.Linear --Tells how will the tweens speed get adjusted throughout the tween.
,Enum.EasingDirection.InOut --Tells the direction in which easing style is applied.
,false --boolean for telling if it reverses to orignal state.
,0 --Tells how many times tween repeats.if set to negative,tween will repeat infinitely.
,0 --Delay in between repeatations in seconds.
)

TweenService:Create(workspace.Part,TweenInfo)

3rd param is a table.this describes what properties are to change.this is the format for table.

local TweenTable = 
{
["Propeeties Exact Name"] = value
}

Now compile this together to this.

local TweenService = game:GetService("TweenService")
local Part = workspace.Part
local TweenInfo = TweenInfo.new(5)
local TweenTable = {["Position"] = Vector3.new(10,10,10)}
Tween = TweenService:Create(Part,TweenInfo,TweenTable)
Tween:Play()