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

why does this script that is supposed to weld a body to the vehicleseat not work?

Asked by 4 years ago

well i made a script that is supposed to weld a body in a vehicleseat. It works, but for other players it just falls off.

local parts = script.Parent:GetDescendants()
wait(1)
for i = 1, #parts do
    if parts[i]:IsA("MeshPart") then
        local w = Instance.new("Weld")
        w.Part0 = script.Parent.Parent.VehicleSeat
        w.Part1 = parts[i]
        w.C0 = script.Parent.Parent.VehicleSeat.CFrame:Inverse() *script.Parent.Parent.VehicleSeat.CFrame
        w.C1 = parts[i].CFrame:inverse() * script.Parent.Parent.VehicleSeat.CFrame
        w.Parent = script.Parent.Parent.VehicleSeat
    end 

        if parts[i]:IsA("Part") then
        local w = Instance.new("Weld")
        w.Part0 = script.Parent.Parent.VehicleSeat
        w.Part1 = parts[i]
        w.C0 = script.Parent.Parent.VehicleSeat.CFrame:Inverse() *script.Parent.Parent.VehicleSeat.CFrame
        w.C1 = parts[i].CFrame:inverse() * script.Parent.Parent.VehicleSeat.CFrame
        w.Parent = script.Parent.Parent.VehicleSeat
        end 
                if parts[i]:IsA("UnionOperation") then
        local w = Instance.new("Weld")
        w.Part0 = script.Parent.Parent.VehicleSeat
        w.Part1 = parts[i]
        w.C0 = script.Parent.Parent.VehicleSeat.CFrame:Inverse() *script.Parent.Parent.VehicleSeat.CFrame
        w.C1 = parts[i].CFrame:inverse() * script.Parent.Parent.VehicleSeat.CFrame
        w.Parent = script.Parent.Parent.VehicleSeat
                end 
                        if parts[i]:IsA("BasePart") then
        local w = Instance.new("Weld")
        w.Part0 = script.Parent.Parent.VehicleSeat
        w.Part1 = parts[i]
        w.C0 = script.Parent.Parent.VehicleSeat.CFrame:Inverse() *script.Parent.Parent.VehicleSeat.CFrame
        w.C1 = parts[i].CFrame:inverse() * script.Parent.Parent.VehicleSeat.CFrame
        w.Parent = script.Parent.Parent.VehicleSeat
                        end 
                                if parts[i]:IsA("WedgePart") then
        local w = Instance.new("Weld")
        w.Part0 = script.Parent.Parent.VehicleSeat
        w.Part1 = parts[i]
        w.C0 = script.Parent.Parent.VehicleSeat.CFrame:Inverse() *script.Parent.Parent.VehicleSeat.CFrame
        w.C1 = parts[i].CFrame:inverse() * script.Parent.Parent.VehicleSeat.CFrame
        w.Parent = script.Parent.Parent.VehicleSeat
        end 
end
0
nice text art there TheluaBanana 946 — 4y
0
Is this a localscript or a server script? AnonymouseCow 23 — 4y

Answer this question