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

Can someone fix my script?

Asked by 9 years ago

Please make your question title relevant to your question content. It should be a one-sentence summary in question form.

So I have different sandwich parts in a tool, and the parts are together in a tool. I have this welding script, and I am wondering why it is not working. I named one part engine, as you do to activate it.

function Weld(x,y)
    local W = Instance.new("Weld")
    W.Part0 = x
    W.Part1 = y
    local CJ = CFrame.new(x.Position)
    local C0 = x.CFrame:inverse()*CJ
    local C1 = y.CFrame:inverse()*CJ
    W.C0 = C0
    W.C1 = C1
    W.Parent = x
end

function Get(A)
    if (A.className == "Part") or (A.className == "Seat") then
        Weld(script.Parent.Engine, A)
    else
        local C = A:GetChildren()
        for i=1, #C do
        Get(C[i])
        end
    end
end

function Finale()
    Get(script.Parent)
end

Finale()
0
Are you sure all the parts are "Part" or "Seat" types not Wedges or Unions? Wizzy011 245 — 9y
0
Yes kelimeguy 60 — 9y

Answer this question