How do I properly UpdateAsync an OrderedDataStore?

So according to this tutorial How to properly utilize UpdateAsync as well as other posts i’ve seen, a common way to use UpdateAsync is to create a DataVersion number inside the datastore like this to safely update data

ds:UpdateAsync(key, function(pastData)
    if pastData.DataVersion ~= player.DataVersion.Value then
        return nil --// Cancels saving data, doesn't do a write request.
    end

    return {
        --// Data is safe to overwrite!
        DataVersion = player.DataVersion.Value + 1
    }
end)

But then how would i do the same for an OrderedDataStore without it getting sorted too? Or is there a better way to UpdateAsync an OrderedDataStore?

1 Like