Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

I need help making welding models to a part?

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

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.

This discussion is preserved as it was. New answers, comments, and votes are closed.