I don’t know much about tweens,so this is probably a dull post.The problem,is that the parts in the flyingislandfolder stack on eachother,and the tween works only once.Here is the script:
local TweenService = game:GetService("TweenService")
local flyingIslandFolder = script.Parent
local partsToMoveThrough = {workspace:FindFirstChild("ape"), workspace:FindFirstChild("ape2"), workspace:FindFirstChild("ape3")}
local function movePart(part, targetPosition)
local tweenInfo = TweenInfo.new(2, Enum.EasingStyle.Linear, Enum.EasingDirection.Out)
local tween = TweenService:Create(part, tweenInfo, {Position = targetPosition})
tween:Play()
tween.Completed:Wait()
end
for _, child in flyingIslandFolder:GetChildren() do
if child:IsA("BasePart") then
coroutine.wrap(function()
for i, targetPart in pairs(partsToMoveThrough) do
if targetPart then
movePart(child, targetPart.Position)
else
print("Target part not found")
end
end
end)()
end
end
So you want to tween the entire model?
Anchor the biggest Part, Unanchor all the rest of them, and weld them to the Anchored Part.
Tween the anchored part.
Following onto @Scottifly ‘s statement, if you want, anchor the MAIN part.
This is the part where other parts will orient around. Such as the main part of a door, the centre of a cup, etc.
After anchoring the main part, UNANCHOR the rest. Then, you can use a WELD to attach them together and hey presto, you’ve got multiple parts moving in one tween!
Tweens don’t work with constraints. They don’t modify the part position/orientation physically, so the part tweened is not block by physics around it (this is why tweened parts can overlap each other).
I think the best way to move multiple parts is by welding them together (using WeldConstraints) and using an AlignPosition object to move the group of parts to a wanted position. If you prefer using parts rather than raw position, you can simply get the position of your parts in the script. Here’s an example :
-- Using raw positions
local WantedPosition = Vector3.new(X, Y, Z)
local AlignPosition = Path.To.AlignPosition
AlignPosition.Mode = Enum.PositionAlignmentMode.OneAttachment -- Only one attachment in the main part
AlignPosition.Position = WantedPosition
-- Using other parts as positions
local WantedPosition = Path.To.OtherPart.Position -- Get the part's position
local AlignPosition = Path.To.AlignPosition
AlignPosition.Mode = Enum.PositionAlignmentMode.OneAttachment -- Only one attachment in the main part
AlignPosition.Position = WantedPosition
OP said nothing about using Constraints or being worried about the tweened island being blocked by physics.
WeldConstraints work with tweens if they are used between the Anchored tweened Part and any other Parts in the model that are Unanchored.
@ALTHumanYessir I’m not sure what you mean by ‘silent’ Parts. With your script you were tweening every single Part inside your coroutine to the exact same Position. As has been said before you only need to tween one of the Parts of the model. If the other Parts are unanchored they’ll follow it.
@AmazingBarnabe please reply to the actual person you meant to reply to. Your replies to me and yourself means OP won’t get notifications of those posts.