So, I have been making some progress on a new game I'm making, but when I tried making a datastore to save a value that determines whether the player has bought a map, it does not save.
To determine if the player has bought a map, I use BoolValues that save through a Datastore. If the value is false, then the player doesn't have it. If the value is True, the player does have it. But, every time I and my Testers play the game, the datastore never saves and the game makes us purchase the Map again with In-Game currency. This is very frustrating and I am trying to find a way to fix this.
All the BoolValues to save the Maps are located in the ReplicatedStorage
Here is my Datastore Script:
local mds = game:GetService("DataStoreService"):GetDataStore("MapDataStore1") local rs = game:GetService("ReplicatedStorage") game.Players.PlayerAdded:Connect(function(plr) wait() local key = "user_"..plr.UserId local mapsave1 = rs.PurchaseSaves.Map2Purchased local mapsGetSaved = mds:GetAsync(key) if mapsGetSaved then mapsave1.Value = mapsGetSaved[1] else local MapsForSave = {mapsave1.Value} mds:GetAsync(key, MapsForSave) end end) game.Players.PlayerAdded:Connect(function(player) local mapsave1 = rs.PurchaseSaves.Map2Purchased mds:SetAsync("user_"..player.UserId, {mapsave1.Value}) end)
When I Test and Play the game, it never shows any errors. Any help?
JackYT_gaming123 are you by chance using a tutorial? If so go check the comments and/or the description they may have found a problem in the code or the codes just not giving the player enough time to lode.