Wondering how to make certain objects move using Lua

Could someone explain to me how I could make this script work and how I can make only chosen objects move.

Thank you.

1 Like


CFrames, BodyMovers like @RogueMage Said, Tweening, Lerps, and a ton of other things.

I am still confused on how to use this.:grimacing:

Your problem is extremely vague and abstract. Please provide a detailed description of your problem so your use case and issue can be addressed adequately. See the Scripting Support guidelines as well before creating threads. There’s no indication of:

  • Prior attempts to accomplish this

  • Efforts to search or investigate how to resolve your issue

  • A specific problem listed

  • Explanation and samples of faulty implementation - what is “this script”?


I’ve seen this question a lot… you should probably search for similar questions before making a post.

If you want to move certain objects to a decided position, you should use either Vector3’s or CFrame’s. These containers can hold information about a specific point in space (And for CFrame’s, even rotation!).

I suggest taking a peek at this post here on the developer forums, as it clearily explains how these work:

This question is super vague, please provide some more information so that we can help you easier. However, I think I get what you are asking.

If you want objects like, parts, then you are after TweenService. Here is a quick example of how to do this:

local TweenService = game:GetService("TweenService") -- TweenService
local MovingPart = workspace.MovingPart -- The part you want moved

local tweenInfo = TweenInfo.new(  -- The tween information
	5, -- How much time the tween takes.
	Enum.EasingStyle.Linear, -- Easing Style of the tween
	Enum.EasingDirection.Out,  -- Easing direction of the tween
	1, -- Number of times the tween should repeate
	false, -- If the tween should repeate
	1 -- Delay between each tween

local Tween = TweenService:Create(MovingPart,tweenInfo,{Position = Vector3.new(0,0,0)}) -- Sets up the tween

Tween:Play() -- Call this each time you want the part to move

You can also use TweenService to move gui objects smoothly, read this article to find out about how to format the tween for gui objects: https://developer.roblox.com/en-us/api-reference/function/GuiObject/TweenPosition. Then here is a quick example:

local TweenService = game:GetService("TweenService") -- TweenService
local Frame = script.Parent.Frame -- The gui object that you want to be tweened


So I want to have an object move in a certain direction at a certain speed, I’d also be thankful if someone could explain how to rotate it while moving. Thanks!

Please make sure to go over our guidelines when creating topics in this category: