Tween animation not following player

I’m currently experimenting with TweenService on an orb that spawns when a player joins. The goal is to have it follow the player adjacent to their torso, but my current method has the animation stuck in place, with the current torso position not updating.

MncNtxBdeV

my code:

local start = {}
	    start.Position = torso.Position + Vector3.new(-1.9,1,1.1)
local finish = {}
		finish.Position = torso.Position + Vector3.new(-1.9,2,1.1)

local twinfo = TweenInfo.new(
		1,
		Enum.EasingStyle.Sine,
		Enum.EasingDirection.InOut,
		0,
		false,
		0)

		local tween1 = TweenService:Create(part,twinfo,start)
		local tween2 = TweenService:Create(part,twinfo,finish)
		local run = coroutine.create(function()
			while true do
				tween1:Play()
				wait(1)
				tween2:Play()
				wait(1)
			end
		end)
		coroutine.resume(run)
1 Like

it may have to do with the fact that the vector 3 never updates, so the start position and end position will always be what it was first set as

local run = coroutine.create(function()
while true do
local start = {}
	    start.Position = torso.Position + Vector3.new(-1.9,1,1.1)
local finish = {}
		finish.Position = torso.Position + Vector3.new(-1.9,2,1.1)

local twinfo = TweenInfo.new(
		1,
		Enum.EasingStyle.Sine,
		Enum.EasingDirection.InOut,
		0,
		false,
		0)

		local tween1 = TweenService:Create(part,twinfo,start)
		local tween2 = TweenService:Create(part,twinfo,finish)
		
			
				tween1:Play()
				wait(1)
				tween2:Play()
				wait(1)
			end
		end)
		coroutine.resume(run)

its not that hard to fix I think this should do

I would also recommend using humanoid root part as this script would break on an r16 char , I don’t know how you set your game so this may ignored if it’s not a problem