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.
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)
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)
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