I have been trying to Tween certain parts in a Model together. The issue is that the parts will not move. All of the parts being Tweened are Unanchored, and are all Welded. There is a Motor6D in a part called Position1 which is the object that is being Tweened. The Motor6D is attached to the main part or “Grass”.
In my script everything prints fine, and I have received no errors from the output.
I can’t really think of what I did wrong, maybe I messed up the Part0/1’s or the C0/1’s?
Model = script.Parent
Pos1 = Model.Position1
Pos2 = Model.Position2
Grass = Model.PrimaryPart
TweenService = game:GetService("TweenService")
--Make Position Parts Invisible--
Pos1.Transparency = 1
Pos2.Transparency = 1
--Motor6D/Weld--
for _,Part in pairs(Model:GetChildren()) do
if Part:IsA("Part") and Part ~= Grass and Part ~= Pos1 and Part ~= Pos2 then
local Weld = Instance.new("Weld")
Weld.Name = Part.Name.."'s Weld"
Weld.Part0, Weld.Part1 = Part, Grass
Weld.C0 = Part.CFrame:inverse()
Weld.C1 = Grass.CFrame:inverse()
Weld.Parent = Grass
end
end
local Motor6D = Instance.new("Motor6D")
Motor6D.Part0, Motor6D.Part1 = Grass, Pos1
Motor6D.C0 = Grass.CFrame:inverse()
Motor6D.C1 = Pos1.CFrame:inverse()
Motor6D.Parent = Pos1
--Movement--
Info = TweenInfo.new(4, Enum.EasingStyle.Linear, Enum.EasingDirection.Out)
Tween = TweenService:Create(Motor6D, Info, {})
function Move()
print("Function Called")
--Set Tween--
if Grass.Position == Pos1.Position then
Tween = TweenService:Create(Motor6D, Info, {C1 = Pos2.CFrame:inverse() * CFrame.new(0,0,0)})
print("Move To Pos2")
else
Tween = TweenService:Create(Motor6D, Info, {C1 = Pos1.CFrame:inverse() * CFrame.new(0,0,0)})
print("Move To Pos1")
end
--Play/Complete--
Tween:Play()
print("Played")
Tween.Completed:Connect(function()
print("Done")
wait(3)
Move()
end)
end
Move()