Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Is there a variable that is infinite?

Asked by
baxzzi 42
5 years ago

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
0
math.huge User#19524 175 — 5y
0
at line 15, Use CFrame instead. cherrythetree 130 — 5y

2 answers

Log in to vote
0
Answered by
sozzly 0
5 years ago

try a while loop (i.e while wait() do)

0
That doesn't work for me because the "while" gets a red underline baxzzi 42 — 5y
0
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. Delude_d 112 — 5y
Ad
Log in to vote
0
Answered by
Delude_d 112
5 years ago

--[[ 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()

Answer this question