Summary
In this chapter, we went from almost no data store experience to an advanced level. We started the chapter with an introduction to data stores. Here, we have seen how to use the primary data store functions, such as :GetDataStore()
, :GetAsync()
, :SetAsync()
, and :RemoveAsync()
. While using these functions, we learned that many things could go wrong working with data stores. As programmers, we have to prepare ourselves for the worst-case scenario. Because of this, we learned how to implement basic error handling using the pcall()
function.
We have learned that it is best to use as few separate data stores as possible. We aim to create just one or two data stores per game. To achieve this, we have seen how to use tables and dictionaries for the data that is saved in data stores.
Because of limitations, we learned to use caching because we cannot keep getting and setting tables and dictionaries from the data store. We have seen how to load and cache player data in a table...