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

How to make unanchored parts stay in a box?

Asked by 3 years ago

Please include the code which you are trying to use, so the community will be better-equipped to help you with your problem.

So I have a box filled with unanchored cubes and I tween the box to move to another destination. However, the unanchored cubes in the box do not move along with the box i am tweening to move. Once the box has reached its destination i want the unanchored cubes inside the box to stay unanchored. So what can I do to keep unanchored cubes inside of a box tat is moving?

1 answer

Log in to vote
1
Answered by 3 years ago

maybe you can weld them to the box while the tween is playing then un-weld them when the tween is over.

like this:

01--put the cubes in a folder or model
02 
03local cubes = --the model or folder the cubes are in
04local box = --the box you're trying to tween
05 
06 
07for _, cube in pairs(cubes:GetChildren()) do
08local weld = Instance.new("Weld")
09weld.Parent = cube
10weld.Part0 = cube
11weld.Part1 = box
12end
13 
14--your tween code here
15 
View all 25 lines...
Ad

Answer this question