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

:Lerp model does not goes smooth?

Asked by 4 years ago

Howdy!

First, check this GIF: https://gyazo.com/692e331b2b8664da939ae95d57d65977

Second, i made this script:

local Cart = workspace:WaitForChild('Train1')
local Train1 = Cart:WaitForChild('FrontCar')
local ThisCar = script.Parent
local Tracks = workspace:WaitForChild('Tracks')
local TrackNumb = 1
local Int = 0.01


repeat
    local Stop = script.Parent.StopValue.Value
    Finish = workspace.Tracks:FindFirstChild('Part'..TrackNumb).CFrame
    for i = 0,1,Int do
        local CFrameMath = script.Parent.FrontCar.PrimaryPart.CFrame:lerp(Finish,i)
        Train1:SetPrimaryPartCFrame(CFrameMath)
        wait()
    end  
    TrackNumb = TrackNumb +1
    if TrackNumb >6 then
        wait()
        TrackNumb = 1
    end
until Stop == true

Now, as you can see on the GIF, my train stops at every Brick. But i'd like it to not stop on every one, but go towards it and when nearby to it, it goes to the second, and so on the third, fourth, fifth, and so on.

People have been telling me to go on Tween, but tween does not make a train properly go make a turn. So i'm stuck to CFrame. But, now this is the struggle i got to deal with.

Any captain here so serve this poor citizen?

1 answer

Log in to vote
0
Answered by 4 years ago

When the block is moving, you must make it move like legit ever 0.3 seconds for it to run smooth, you might also have to add a speed. Sorry I wasn't helpful but here is a link to a guy that is perfect at explaining that.

https://www.youtube.com/watch?v=Yhg6_2UjtCM

Hope this message or link helped!

0
I've seen his video yeah. I'll take a look at it again HeadlessDeathSpeaker 9 — 4y
Ad

Answer this question