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?
✓ ANSWER ACCEPTED
How to make unanchored parts stay in a box?
1 answer
✓ Accepted answer
maybe you can weld them to the box while the tween is playing then un-weld them when the tween is over.
like this:
--put the cubes in a folder or model
local cubes = --the model or folder the cubes are in
local box = --the box you're trying to tween
for _, cube in pairs(cubes:GetChildren()) do
local weld = Instance.new("Weld")
weld.Parent = cube
weld.Part0 = cube
weld.Part1 = box
end
--your tween code here
--to destroy the welds
for _,v in pairs(cubes:GetChildren()) do
if v:IsA("Weld") then -- checks if it's a weld
v:Destroy()--destroys it
end
end
This discussion is preserved as it was. New answers, comments, and votes are closed.
