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

How to attach other children to the parent? [UNANSWERED]

Asked by 6 years ago
Edited 6 years ago

While I change the parent's position and orientation to a certain number, is it possible to attach a child, which would change it's position and orientation in a similar way to keep it intact? (Anything but unions)

I would love an example, if you have one.

Thank you

0
What I mean is, how to attach anchored objects to each other, so when they move with a specific script - they stay together. Krolaer 6 — 6y
0
welding. Earthkingiv 51 — 6y

2 answers

Log in to vote
0
Answered by 6 years ago
function Weld(p1, p2)
    local w = Instance.new("Weld", game.JointsService)
    w.C1 = p1.CFrame:toObjectSpace(p2.CFrame)
    w.Part0 = p2  
    w.Part1 = p1
end

Weld(Workspace.Part1, Workspace.Part2)

Use welding. Seriously. If there are more than 2 parts that you would like to weld, just extend the list of arguments by using px, where x is the number set in the list going from 1 to whatever number may be used. Then, follow up with w.Partx, where, again, x is the set number in that list. It's really quite that simple to make a welding script once you get used to it.

Ad
Log in to vote
0
Answered by 6 years ago

You can weld the part to the parent. Search up on the wiki on how to weld and it gives a good example. (would give a link but wiki is blocked at school)

Answer this question