How would I move a part to a certain location using a script? [SOLVED!]

I would love to move a part to a certain location smoothly using a script.

The problem is that I do not know where to start.

How would I go about making this?
Please help.

Try tweening it with TweenService or if you want to go with the built-in AlignPosition, go ahead

I am a little confused

How would this go in a Script?

local TweenService = game:GetService("TweenService")

local target = workspace.target
local part = workspace.Part

TweenService:Create(
Part,
TweenInfo.new(1, Enum.EasingStyle.Linear) -- Linear tween (constant speed)
{
   Position = target.Position
}
):Play()

I recommend you to read TweenService and TweenInfo

Like just @Artzified say, you could use TweenService.

Here is a sample TweenService code and a little explanation:

local TweenService = game:GetService("TweenService")
local part = script.Parent

local tweenInfo = TweenInfo.new(
	2,							-- Length
	Enum.EasingStyle.Linear,	-- Movement Style	
	Enum.EasingDirection.Out,	-- Direction
	0,							-- Repeat Count
	false,						-- Reverse (true/false)
	0							-- Delay Time
)

local properties = {
	Position = Vector3.new(1,2,3) -- Destination Part
}

local tweenCreate = TweenService:Create(
	part,		-- The part you want to move
	tweenInfo,	-- TweenInfo
	properties	-- Properties Array
)
1 Like