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:
01 | script.Parent.MouseClick:Connect( function () |
02 | local Restrains = workspace.Freefall.Cart |
03 | local All = Restrains:GetChildren() |
04 | for i,v in pairs (All) do |
05 | if v.Name = = "Restraints" then |
06 | local weld = Instance.new( "Weld" ) |
07 | weld.Parent = workspace.Freefall.Cart.Model.Motor |
08 | weld.Part 0 = workspace.Freefall.Cart.Model.Motor |
09 | weld.Part 1 = v.Welded --have no idea how to weld |
10 | end |
11 | end |
12 | end ) |
:)
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
1 | local part 0 = game.Workspace.Part 0 --Part0, can be any part |
2 | local part 1 = game.Workspace.Part 1 --Part1, can be any part |
3 |
4 | local weld = Instance.new( "Weld" ) |
5 | weld.Parent = game.Workspace --Or whatever else you would like |
6 | weld.Part 0 = part 0 |
7 | weld.Part 1 = part 1 |
The only problem I could find in your script is that you did not understand how to assign Part1, but here you go.