DataStore Leaderboard Overloading

I was not able to find any issues with your code. After testing the data-store, it seems that the “Donations” ordered data-store is corrupt. I first removed the record of the only apparent donation. When attempting to retrieve the maximum number of elements on a single page, the reported elements is 0. However, when reading .IsFinished, the value is false. This is a clear contradiction, and should be reported as an engine bug. I moved your data-store to “DonationsB”, and restored the previous record. All seems to be working now

2 Likes

When hitting the last page of ordered datastore pages, IsFinished is bugged and never becomes true. Instead of lingering on the last page when calling advance(), it loops around to the first page for some reason. I worked around this by storing the first key of the first page and checking the first key of every subsequent page against that key

sample
	ReadPageAndContinue = function(pages :DataStorePages, list :list, limit :uint, DelayTime :uint,
																		   FirstKey :string?) :uint
		local page = pages:GetCurrentPage()
		--Duplicate loop around page check since IsFinished property is broken half the time
		local CurrentPageFirstKey = page[1].key
		if FirstKey and CurrentPageFirstKey == FirstKey then return 2 end

When using a separate ordered data-store, .IsFinished began operating as normal; I’m not sure the issue is consistent, so it’s better to call that a fail-safe. I wonder what triggers the bug

Some user here says it might be older ordered datastores that are broken, but I created a bunch of ordered data stores in a test place, and half of them were bugged, and half of them were working. The test place was a couple months old and that might have to do with the bug too.

1 Like