How would I turn this into something that uses 'RenderStepped' or 'Heartbeat' so that the model's movement is smoother

local abbyee = workspace.abbyee

	while true do
		
		for i = 1,5 do
			abbyee:SetPrimaryPartCFrame(CFrame.new(abbyee.PrimaryPart.Position + Vector3.new(0,1,0)))
			wait(.2)
		end

		for i = 1,5 do

			abbyee:SetPrimaryPartCFrame(CFrame.new(abbyee.PrimaryPart.Position - Vector3.new(0,1,0)))
			wait(.2)
		end
	end

here is my script ^

i’m pretty awful at scripting, go easy on me

right now, my model moves up and down but its super choppy and i want to make it move very smoothly up and down.

1 Like

This doesn’t answer your question fully but I would suggest TweenService for that type of stuff

This service helps for smoothly moving objects

RunService wouldn’t be good since it is based on frames and the movement speed can vary

i thought i was already using it im confused

no??? you are only changing CFrame
you aren’t using tweenservice in the script you showed

oh whoops sorry im stupid aahhhh

how would i add tweenservice to this script

the link about tweenservice from @PostVivic explains everything

im sorry ive been looking at it and trying things on it for a while nothing is working

tweenservice example

local TS = game:GetService("TweenService")

local Properties = {CFrame = EndingCF}--The properties you are trying to tween to

local TInfo = TweenInfo.new(Time, Enum.EasingStyle.Linear, Enum.EasingDirection.Out)--create tween info

local MyTween = TS:Create(InstanceToTween, TInfo, Properties)--Get your tween object

MyTween:Play()--finally play the tween
		
		for i = 1,5 do
			abbyee:SetPrimaryPartCFrame(CFrame.new(abbyee.PrimaryPart.Position + Vector3.new(0,1,0)))
			wait(.2)
		end

		for i = 1,5 do

			abbyee:SetPrimaryPartCFrame(CFrame.new(abbyee.PrimaryPart.Position - Vector3.new(0,1,0)))
			wait(.2)
		end
	end

here is what i have. note, it is a model made up of a few parts and i also saw something about a primary part so idk what to do with that