How can I make UIPageLayout repeat same process?

Hey there,

Currently I’m trying to make a menu TV like ‘Cafe groups’ on Roblox. As you know we have ‘Completed’ value in TweenService.

local TweenService = game:GetService('TweenService')

local MyTween = TweenService:Create(BOOL, TweenInfo, {Something = number})
MyTween:Play()
MyTween.Completed:Wait()

My questions is, is there any way to make the UIPageLayout do the same process? (Avoid while true do)

My code:


local t = 0

function GetChildren(Model)
	for _, v in pairs(Model:GetDescendants()) do
		if v:IsA('SurfaceGui') then

			local UIPageLayout = v.Frame:FindFirstChild('UIPageLayout')
			
			UIPageLayout:Next()
		end
	end
end


function Init()
	for _, Model in pairs(CollectionService:GetTagged('Menu')) do
		GetChildren(Model)
	end
end


RunService.Heartbeat:Connect(function(deltaTime)
	t = t + deltaTime

	if t >= 5 then
		Init()
		t = 0
	end
end)

Thanks, Dev_Cron.