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

How would I save the CFrame of a brick before it is changed?

Asked by 6 years ago

I have a tweening script that would tween bricks to its position in a model. However, when I run it, I end up with this. Any help? Here is the code.

ts = game:GetService('TweenService')
CValues = {}

wait(5)

BuildBrick = function(v)
    local info = TweenInfo.new(
        1,
        Enum.EasingStyle.Back,
        Enum.EasingDirection.Out,
        0,
        false,
        0
    )   
    local goals = {
        Transparency = 0;
        CFrame = CValues[1]
    }

    local tween = ts:Create(v,info,goals)
    tween:Play()
end

for i,v in next, workspace.FM.Model:GetChildren() do
    table.insert(CValues, 1, v.CFrame)
    v.Transparency = 1
    v.CFrame = workspace.FPos.CFrame
    spawn(function() BuildBrick(v) end)
end

Answer this question