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

Anybody have a good part tweening snippet?

Asked by 10 years ago

My idea is: Get the magnitude between the start and the end parts and divide it on 10 steps, every step being reproduced every Decimal of second (0.1), then get the part, each cycle adding one of the steps to the movement, and when it is on the 9th step, finish the translation and break the loop.

function tweenPart(part, pos, timer)
    local mathclass = ((part.Position.magnitude - pos.p.magnitude).magnitude)
    local times = 10
    repeat
        wait(timer)
        times = times - 1

        if times == 1 then
            part.CFrame = pos
            break
        end

        part.CFrame = part.CFrame + mathclass
    until times == 0
end

Yes, I know this won't work. Just giving a base to you try to help me.

Thanks, in advance.

0
Bump 1 lucas200206 90 — 10y

Answer this question