So I feel like this is a small thing, but I looked in the developer hub and I couldn’t find much. At first I was kinda lost, and then I figured somethings out. Anyway what do I set the value to to loop it? (God my grammar here sucks)
iirc you cannot loop TweenPosition and TweenSize. Consider using TweenService since it has a repeatcount parameter. Setting it to -1 will loop your tween infinitely.
That’s not what the callback argument is for. The function will run the callbackfunction once the tween has finished running.
It’s a bit unclear what you’re asking, by the way. Are you asking how to loop it or something relating to the callback? If you’re asking how to loop it, you might want to look into TweenService, a much more powerful service than the TweenPosition and TweenSize functions.
You could actually use that callback to re-start the tween, in an infinite loop - or until some condition tells it to stop:
local stopPlayingTween = false
local originalStartPosition = image.Position
local function PlayTweenAnimation(playbackStatus)
-- Verify the 'continue-or-stop condition' allows us to continue
if not stopPlayingTween then
if nil == playbackStatus or playbackStatus == Enum.TweenStatus.Completed then
-- Before starting tween, set image's position back to the original position
image.Position = originalStartPosition
image:TweenPosition(
UDim2.new(0,0,0,-1000),
Enum.EasingDirection.Out,
Enum.EasingStyle.Quad,
10,
false,
PlayTweenAnimation -- When tween finishes, then call this function
-- "Let's do the twist^h^h^h^h^h tween again"
)
end
end
end
-- To initiate the continuous tween animation, call function without any argument
PlayTweenAnimation()
-- And to avoid the "tween callback loop" continues forever,
-- then set the 'stop condition', possibly after some time has passed,
-- or when player does something.
wait(30)
stopPlayingTween = true