I have a problem i want to know DataStoreService but i cant take it from yt tutorials. Can someone write in the comments about whole DataStore very easily and aslo really saying about that things that are in the script. Pls
When creating a datastore you use the Datastore service within ROBLOX.
You would first have to create a value within the player upon joining the game, in this case I will use money as an example. To do that you would have a starter player script with something like the following:
local money = Instance.new("IntValue",player) money.Name = money
This would create the value within the player.
Next, you'd have to use the :GetAsync to get the player's value from the datastore. Remember to get the Datastore service. Something like as follows:
local playerStorage = game:GetService("DataStoreService"):GetDataStore(tostring(player.userId)) playerStorage:GetAsync("money")
During the game if the datastore is to change you should update it using :SetAsync. Keeping in mind playerStorage has already been defined. Something like as follows:
playerStorage:SetAsync("money",500)
Setting the money value to 500
Play around with it a little and read this article for more information and help: https://developer.roblox.com/en-us/articles/Data-store
Closed as Not Constructive by Nguyenlegiahung, JesseSong, killerbrenden, jediplocoon, matiss112233, and TaxesArentAwesome
This question has been closed because it is not constructive to others or the asker. Most commonly, questions that are requests with no attempt from the asker to solve their problem will fall into this category.
Why was this question closed?