So I want to repeat a Tweened part animation infinitely, I'm fairly new to scripting and I'm currently using for i = 1,1 do
. However, this makes the part go back to it's original location. I just want to know if there is a variable to repeat this Tween so it never ends.
local tweenService = game:GetService("TweenService") local part = script.Parent local tweeningInformation = TweenInfo.new( 2, -- Length Enum.EasingStyle.Sine, Enum.EasingDirection.InOut, 10, -- Number of times the tween will repeat false, -- Should the tween repeat? 2 -- delay ) local partProperties = { Position = Vector3.new(-21.6,-21.4,-46) } local Tween = tweenService:Create(part, tweeningInformation, partProperties) for i = 1,1 do Tween:Play() end
try a while loop (i.e while wait() do)
--[[ Tweens can loop infinitely without a loop required (i'm pretty sure). There's a float named "time" which tells the tween to repeat "time".Value. Change that float value to math.huge. Something to make the number infinite. The float is in the fourth arguement. Ye, you wrote it down as 10 times to repeat. ]]
local tweenService = game:GetService("TweenService") local part = script.Parent local tweeningInformation = TweenInfo.new( 2, -- Length Enum.EasingStyle.Sine, Enum.EasingDirection.InOut, math.huge, -- Number of times the tween will repeat false, -- Should the tween repeat? 2 -- delay ) local partProperties = { Position = Vector3.new(-21.6,-21.4,-46) } local Tween = tweenService:Create(part, tweeningInformation, partProperties) Tween:Play() ---- to cancel tween, use Tween:Cancel()