Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Why is my lerp going in 1 second intervals and not more smoothly?

Asked by 4 years ago
Edited 4 years ago

I've been at this for a while and this may be a stupid questions but I'd like some help.

local Part1 = script.Parent.Pri
local Part2 = script.Parent.Part
local Model = script.Parent
Model.PrimaryPart = Part1
local Primary = Model.PrimaryPart
local Endpoint = game.Workspace.Endpoint.CFrame
for i = 0,1,0.01 do
    Model:SetPrimaryPartCFrame(Model:GetPrimaryPartCFrame():Lerp(Endpoint,i))
    wait()
end

I tried to change the 0.01 but that didn't do anything. It does move but in 1 second intervals and it's not looking smooth. Could someone tell me what I'm doing wrong? Thanks!

0
Instead of wait() use RunService with RenderStepped. That way, it runs with the frames instead of desynced. game:GetService("RunService").RenderStepped:Wait(). This will call wait() until the next frame is loaded killerbrenden 1537 — 4y
0
Try using TweenService. youtubemasterWOW 2741 — 4y

Answer this question