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

How do you get the key from an inserted value in a a table?

Asked by 6 years ago

So I'm trying to tween a model so it builds bricks from a point. However, the result I get is this.

Any help? Here is the script:

ts = game:GetService('TweenService')
CFrames = {}
BricksBuilt = 0

wait(1)

for i,v in next, workspace.ItemQ:GetChildren() do
    table.insert(CFrames, v.CFrame)
    v.CFrame = workspace.QPos.CFrame
end

BuildBrick = function(child)
    local info = TweenInfo.new(
        1,
        Enum.EasingStyle.Quint,
        Enum.EasingDirection.Out,
        0,
        false,
        0
    )   
    local goals = {
        CFrame = CFrames[BricksBuilt]
    }   
    local tween = ts:Create(child,info,goals)
    tween:Play()
    BricksBuilt = BricksBuilt + 1
end

for i,v in next, workspace.ItemQ:GetChildren() do
    spawn(function() BuildBrick(v) end)
    wait(0.01)
end
0
oops here's the actual link https://gyazo.com/2a85fdc4f59f0c91698e01008f6d99a9 Reziztor 4 — 6y

Answer this question