If I use :GetDataStore() and then change it to :GetOrderedDataStore() later on, will the data stay the same?

The title is basically the question lmao

7 Likes

The data does not stay the same. Completely wipes the other data.

4 Likes

I don’t think it wipes the other data; it just gets it from a different datastore.

2 Likes

yeah i exxagerated a bit. im just trying to use :GetSortedAsync() but its too late to change now since all of my players data is going to be reset if i do

3 Likes

So you are trying to convert DataStore into OrderedDataStore?

3 Likes

yes, but im not sure if i really can because i use 1 datastore that has all the players data in a table, and i dont think :GetOrderedDataStore() supports tables/dictionaries as values

2 Likes

You could transfer the data with Open Cloud.

2 Likes

can i transfer tables to :GetOrderedDataStore() ?

4 Likes

Yes, you can use Open Cloud to fetch data from the old non-ordered DS, then reupload it to a new ordered DS.

4 Likes

You could use DataStoreOptions to retrieve data fom DataStore to put into the OrderedDataStore.

local dataStoreOptions = Instance.new('DataStoreOptions')
local dataStore = dataStoreService:GetDataStore('dataStore', dataStoreOptions)

local orderedDataStore = dataStoreService:GetOrderedDataStore('dataStore', dataStoreOptions)

local success, pages = pcall(function()
	return dataStoreBadges:ListKeysAsync()
end)
-- Get datastore pages

while task.wait() do
	local Items = pages:GetCurrentPage()
		
	for _, Data in ipairs(Items) do
		orderedDataStore:SetAsync(Data.KeyName, Data)
	end
		
	if pages.IsFinished then break else pages:AdvanceToNextPageAsync() end
end
2 Likes

I didn’t know that was a thing, apparently you don’t need Open Cloud to copy data between DataStores.

2 Likes

Your data has dictionaries. Are you making a leaderboard that shows players’ points or something?

2 Likes

@AlaTomKing @yname
ok guys all i really want to know is if its possible to transfer tables at this point, because i know how to transfer now, but the normal datastore has tables for every player, and im not sure if it will let me transfer.

2 Likes

yeah

asldkjfa;lsdjf;alskdjfk;lasd

2 Likes

You could make a new OrderedDataStore and only transfer the players’ points.

1 Like

not sure how i can loop through every players stats, copy the points, format it so that its only a key and points, and then paste it into a new OrderedDataStore. might you know?

I’m not sure how your data is structured tho

1 Like
local defaultData = {
	["Wins"] = 0,
	["Money"] = 0,
	["Trails"] = {},
}
1 Like

And do you usually store them using the key of player’s UserId?

2 Likes

yes

ajsk;ldf;alksdjf;lasjdk;lfajsl

1 Like