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

Moving a cart with BodyMovers?

Asked by
dirk2999 103
6 years ago

I have a cart that is going on a track. I do not want the track to be conveyors because of the fact that the players upgrade their carts to go faster. I have this weld script in the cart model

function weld()
    local parts,last = {}
    local function scan(parent)
        for _,v in pairs(parent:GetChildren()) do
            if (v:IsA("BasePart")) then
                if (last) then
                    local w = Instance.new("Weld")
                    w.Name = ("%s_Weld"):format(v.Name)
                    w.Part0,w.Part1 = last,v
                    w.C0 = last.CFrame:inverse()
                    w.C1 = v.CFrame:inverse()
                    w.Parent = last
                end
                last = v
                table.insert(parts,v)
            end
            scan(v)
        end
    end
    scan(script.Parent)
    for _,v in pairs(parts) do
        v.Anchored = false
    end
end

weld()
script:Remove()

I don't know which body mover to use/ which settings. I have tried many of them and no luck. Any help please...

Answer this question