This script builds a model by tweening, however, when I run it, the brick's rotations are fine, but the parts all go to position (0,0,0). How do I fix this? Am I doing something wrong? Here's the script:
wait (5) for index, child in pairs(workspace.ItemF.Model:GetChildren()) do local TweenService = game:GetService("TweenService") local Part = child local Position = child.Position local info = TweenInfo.new( 0.5, Enum.EasingStyle.Back, Enum.EasingDirection.Out, 0, false, 0 ) script.Parent.Value.Value = Vector3.new(Position.X,Position.Y+0.5,Position.Z) local Goals = { Transparency = 0; CFrame = CFrame.fromEulerAnglesXYZ(Part.Orientation.X,Part.Orientation.Y,Part.Orientation.Z, CFrame.new(script.Parent.Value.Value.X,script.Parent.Value.Value.Y,script.Parent.Value.Value.Z)); } local Tween = TweenService:Create(Part,info,Goals) Tween:Play() wait (0.1) end
This has to do with the way you are giving the CFrame. Try giving it like this on line 21
CFrame = CFrame.new(script.Parent.Value.Value.X,script.Parent.Value.Value.Y,script.Parent.Value.Value.Z)*CFrame.fromEulerAnglesXYZ(Part.Orientation.X,Part.Orientation.Y,Part.Orientation.Z)
What you did was give it the rotation then set the cframe after but it reset that rotation, this is the proper way of giving cframe with that type of rotation