Hi, I’m working on this conveyor belt that uses tweenservice. When the envelope reaches it’s tween target position, it should stop the tween, teleport to the other end and repeat the loop.
Code:
local ts = game:GetService("TweenService")
local startPoint = Vector3.new(-172.163, 3.04, -2766.023)
local targetPoint = Vector3.new(-172.163, 3.04, -2766.023)
local tinfo = TweenInfo.new(15, Enum.EasingStyle.Linear, Enum.EasingDirection.Out)
for i,v in pairs(script.Parent:GetChildren()) do
if v:IsA("MeshPart") then
local tween = ts:Create(v, tinfo, {Position = targetPoint})
tween:Play()
local connection = tween.Completed:Connect(function()
wait()
v.Position = startPoint
tween:Play()
end)
end
end
Not sure why this isn’t working, just teleports the envelopes to the target and stays there.