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

I need help making welding models to a part?

Asked by 4 years ago

I am trying to make a weld script that welds the restraints for a theme park I'm making so the restraints don't glitch everywhere. I'm trying to make welds for models.

Here's the script for the weld I was trying to make lol:

script.Parent.MouseClick:Connect(function()
    local Restrains = workspace.Freefall.Cart
    local All = Restrains:GetChildren()
    for i,v in pairs(All) do
        if v.Name == "Restraints" then
            local weld = Instance.new("Weld")
            weld.Parent = workspace.Freefall.Cart.Model.Motor
            weld.Part0 = workspace.Freefall.Cart.Model.Motor
            weld.Part1 = v.Welded --have no idea how to weld
        end
    end
end)

:)

1 answer

Log in to vote
0
Answered by 4 years ago

The only thing I notice is the fact you do not know how to assign Part 0 and Part 1, but this is no problem. All you need to do is:

TIP: Do not weld the same part to itself

local part0 = game.Workspace.Part0 --Part0, can be any part
local part1 = game.Workspace.Part1 --Part1, can be any part

local weld = Instance.new("Weld")
weld.Parent = game.Workspace --Or whatever else you would like
weld.Part0 = part0
weld.Part1 = part1

The only problem I could find in your script is that you did not understand how to assign Part1, but here you go.

Ad

Answer this question