Smooth CFrames without tweening

Hey there! I needed to know if there’s a way to make CFrame smooth without tweening. Currently I’m use task.waiit() with repeat until loops to move my part, but it’s still very choppy. Any help is appreciated.

Hey there! I know you asked without tweenings. But why would you not want to tween for this case?

Sorry for the late reply, I just wanna know if there’s an alternative. I’m familiar with tweening but if there’s another way then I’m all in.

you could always use heartbeat and update the CFrame every time it fires

If you’re making a local script you can utilize RenderStepped and CFrame’s Lerp to lerp the time passed between frames, and where the object is going to, this would make the movement smooth

Yea I am using heartbeat right now.

You could your method task.wait and repeat untill.

But to smoothen it further you need to use the delta time returned by task.wait or heartbeat like so below :point_down:

So how would I go about lerping a model instead of a part?

you could use SetPrimaryPartCFrame() and then lerp the CFrame

What if I wanted to use arrow keys to move it? Will the lerp stop if I let go of a key?

it will if you do it correctly

So how would I go about doing it?

the problem is your moving a anchored part on the server side and because of lag it may not look smooth lag is the delay it takes for information to get sent from the server to the client

if you use a unanchored part roblox will tween/interpolate the part on the client side a little to make it a bit more smoother you can try this by using AlignPosition | Roblox Creator Documentation

for the best result you should tween on the client side

while this video is not about tweening i do cover the problem a little in the start of this video

local RunService = game:GetService("RunService")
local Model = nil -- some model
local Multi = 0
local GoalCFrame = nil -- Some CFrame
local Connection

Connection = RunService.Heartbeat:Connect(function()
	Multi += 0.01 -- the amount the multi will increase per heartbeat
	Model:SetPrimaryPartCFrame(Model.PrimaryPart.CFrame:Lerp(GoalCFrame, Multi))
	if Multi >= 1 then 
		Connection:Disconnect()
	end
end)

something like this?

1 Like

use lerp: What is the :lerp function? - #9 by XdJackyboiiXd21