Need help with smooth movement

so i made a basic code to move a part upwards, but its not as smooth as i would want it to be, i used

while true do
script.Parent.Position = Vector3.new(0,10,0)
wait(0.5)
script.Parent.Position = Vector3.new(0,10.1,0)
wait(0.5)

very simple, but its not smooth, im trying to find a code that can made it smoother

2 Likes

You could tween it for a good smooth part movement

3 Likes

can you please expand on that, i dont know what tween is

Yeah sure tweening is just a way to “animate” parts very smoothly,
Tween | Documentation - Roblox Creator Hub this link explains tweening in a detailed way, scroll down for the correct syntax.

local TweenService = game:GetService("TweenService")
 
local part = script.Parent
 
local goal = {}
goal.Position = Vector3.new(part.Position.X, part.Position.Y+10, part.Position.Z)
 
local tweenInfo = TweenInfo.new(5)
 
local tween = TweenService:Create(part, tweenInfo, goal)
 
tween:Play()
7 Likes

For smooth movement you should be looking at using TweenService. I have made a couple of lengthy replys about how to use TweenService so I suggest you read through them to get an understanding of how to use it(the first post linked uses TweenService on Gui’s but you should be able to adapt it to work for parts in workspace):

and

Do this:

local positions = {posA,posB,...} -- Replace "..." with all your other positions.
local tweenService = game:GetService("TweenService")
local tweenInfo = TweenInfo.new(time,Enum.EasingStyle.YourStyleHere,Enum.EasingDirection.YourDirectionHere)
for _,pos in pairs(positions) do
    tweenService:Create(part,tweenInfo,{Position = pos}):Play() -- What actually moves the part.
    wait(howeverlongyourtimeintweeninfois)
end

@CAKEBOYOFEPICNESS123 use the TweenService for moving parts, people above have offered decent code for it but you can easily learn how to use it on reference pages too, for future reference.

2 Likes