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

Whats an Good Brick Weld Script for Cars?

Asked by 10 years ago

Okay, I have this Car Where all the bricks fall off the front.. I used this Persons Weld scripts but it does not seem to Keep the bricks welded on. I have the script in the Brick Itself. Any Ideas?

t = script.Parent

wait(5)

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

function Weldnow()
    c = t:children()
    for n = 1, #c do
        if (c[n].className == "Part") then
            if (c[n].Name ~= "MainPart") then
                stick(c[n], t.MainPart)
                wait()
                c[n].Anchored = false
            end

    if (c[n].className == "Flag") then
            if (c[n].Name ~= "MainPart") then
                stick(c[n], t.MainPart)
                wait()
                c[n].Anchored = false
            end

                    if (c[n].className == "Handle") then
            if (c[n].Name ~= "MainPart") then
                stick(c[n], t.MainPart)
                wait()
                c[n].Anchored = false
            end

    if (c[n].className == "Hat") then
            if (c[n].Name ~= "MainPart") then
                stick(c[n], t.MainPart)
                wait()
                c[n].Anchored = false
            end
        end
        if (c[n].className == "Seat") then
            if (c[n].Name ~= "MainPart") then
                stick(c[n], t.MainPart)
                wait()
                c[n].Anchored = false
            end
        end
        if (c[n].className == "SpawnLocation") then
            if (c[n].Name ~= "MainPart") then
                stick(c[n], t.MainPart)
                wait()
                c[n].Anchored = false
            end
        end
        if (c[n].className == "TrussPart") then
            if (c[n].Name ~= "MainPart") then
                stick(c[n], t.MainPart)
                wait()
                c[n].Anchored = false
            end
        end
        if (c[n].className == "VehicleSeat") then
            if (c[n].Name ~= "MainPart") then
                stick(c[n], t.MainPart)
                wait()
                c[n].Anchored = false
            end
        end
    end
end

wait()

t.MainPart.Anchored = false

Weldnow()
0
Duplicate question, we have a edit button in case you put in the wrong script on the first question or made a typo. Please stick to your original topic https://scriptinghelpers.org/questions/6996/whats-an-good-brick-weld-script-for-cars Thank you. M39a9am3R 3210 — 10y

Answer this question