I have a leaderboard where the player can go through pages of player names and their highest scores.
It works as intended, but I want the pages to wrap back to the beginning/end if they decide go out of bounds. (if they click ‘previous’ page on the first page, or if they click ‘next’ page on the last page)
UIPageLayout has the Cirular property which I thought does that behavior. But, the code wouldn’t work when the property is enabled, and it’ll be stuck on the first page no matter if I click the ‘previous’ and ‘next’ buttons.
leftPageArrow.Activated:Connect(function()
UIPageLayout:JumpToIndex(UIPageLayout.CurrentPage.LayoutOrder - 1)
end)
rightPageArrow.Activated:Connect(function()
UIPageLayout:JumpToIndex(UIPageLayout.CurrentPage.LayoutOrder + 1)
end)
I previously used UIPageLayout’s Next and Previous functions, but it only mentions that it does “nothing” if there isn’t a next or previous page, regardless if the circular property is enabled.
The JumpToIndex function does mention something about the circular property, " If it’s out of bounds and circular is set, it will animate the full distance between the in-bounds index of UIPageLayout.CurrentPage
and the new index.", but I’m not sure if it does what I want it to do, since I’m not animating the leaderboard.
Also, the leaderboard only has two pages. Maybe it has to do with that?
Any help is appreciated!