Tween glitching after first tween

I have never seen this with tweening but, when I was scripting a tween for a part to go up and down on a while true loop. I had come across a little error where the part does the first tween, then it tries to do the second but it starts to glitch… Not really sure why this is happening, but here is my script…

local TweenService = game:GetService("TweenService")
local part = script.Parent

local info = TweenInfo.new(1,Enum.EasingStyle.Linear,Enum.EasingDirection.Out,0,false,0)

local properties = {CFrame = CFrame.new(405.889, -159.809, -685.613)}
local prop = {CFrame = CFrame.new(405.889, -123.969, -685.613)}

local tween = TweenService:Create(part, info, properties)
local Tween = TweenService:Create(part, info, prop)

while true do
	wait(3)
	tween:Play()
	wait(3)
	Tween:Play()
	wait(3)
end

Since they are in a while true loop, the tweens might be overlapping each other. You can check if it has finished by using tween.Completed = function end

Try Changing properties to a vector3.new instead of cframe

hmmmm, I have another one coded, and it has never done this before.

I already did that, I had it at vector3 before, so I tried cframe, and that didn’t work either.

Try checking if the tween has finished and if it hasn’t, don’t play it again.

sorry, wdym finished? How am I supposed to see if it finished. I’m still pretty new to scripting, sorry.

if tween.Completed == true then
print("completed")
end

nope, never got the message. 30

Here is a script that is similar in usage with the moving parts. This one works fine.

-- Variables


local TweenSerivce = game:GetService("TweenService")
local Pump = {
	part1 = game.Workspace.Pumpkin1; -- Making a table for each part in workspace
	part2 = game.Workspace.Pumpkin2;
	part3 = game.Workspace.Pumpkin3;
	part4 = game.Workspace.Pumpkin4;
	part5 = game.Workspace.Pumpkin5
}
-- Making the Animation

local info = TweenInfo.new(1,Enum.EasingStyle.Linear,Enum.EasingDirection.Out)

local move1 = {Position = Vector3.new(208.31, -67.941, -405.28)}
local Move1 = {Position = Vector3.new(208.31, -70.301, -405.28)}

local pump1 = TweenSerivce:Create(Pump.part1,info,move1)
local Pump1 = TweenSerivce:Create(Pump.part1,info,Move1)

-- repeating process

local move2 = {Position = Vector3.new(201, -67.941, -396.95)}
local Move2 = {Position = Vector3.new(201, -70.301, -396.95)}

local pump2 = TweenSerivce:Create(Pump.part2,info,move2)
local Pump2 = TweenSerivce:Create(Pump.part2,info,Move2)

-- Reapeating again

local move3 = {Position = Vector3.new(208.31, -67.681, -387.81)}
local Move3 = {Position = Vector3.new(208.31, -70.301, -387.81)}

local pump3 = TweenSerivce:Create(Pump.part3,info,move3)
local Pump3 = TweenSerivce:Create(Pump.part3,info,Move3)

-- Again

local move4 = {Position = Vector3.new(215.07, -67.771, -377.43)}
local Move4 = {Position = Vector3.new(215.07, -70.301, -377.43)}

local pump4 = TweenSerivce:Create(Pump.part4,info,move4)
local Pump4 = TweenSerivce:Create(Pump.part4,info,Move4)

-- One last time...

local move5 = {Position = Vector3.new(208.31, -68.561, -366.86)}
local Move5 = {Position = Vector3.new(208.31, -70.301, -366.86)}

local pump5 = TweenSerivce:Create(Pump.part5,info,move5)
local Pump5 = TweenSerivce:Create(Pump.part5,info,Move5)

while true do
pump1:Play()
wait(0.5)
Pump1:Play()
wait(1)
pump2:Play()
wait(0.5)
Pump2:Play()
wait(1)
pump3:Play()
wait(0.5)
Pump3:Play()
wait(1)
pump4:Play()
wait(0.5)
Pump4:Play()
wait(1)
pump5:Play()
wait(0.5)
Pump5:Play()
wait(1)
end

Maybe try making the Table or dictonary(or whatever its called) to position like before

local goal = {Postition= Vector3.new(405.889, -159.809, -685.613)}

I am ahead of you haha, I just tried it again and it did better, but it still is glitching.

What do you mean by glitching, Choppy animations, slow, wrong place?

like it glitches, when it does the tween, it keeps teleporting back where it was before it got down there. So, I guess you could say choppy.

does it effect anything if my code was in a script instead of a local script?

It’s fine, I just decided not to continue with it. It wasn’t even really anything good. Thanks for all the help tho