DataStore working for most variables but not all?
01 | local DataStoreService = game:GetService( "DataStoreService" ) |
02 | local myDataStore = DataStoreService:GetDataStore( "myDataStore" ) |
05 | game.Players.PlayerAdded:Connect( function (player) |
10 | local success, errormessage = pcall ( function () |
11 | Original = myDataStore:GetAsync(player.UserId.. "-OriginalCookie" ) |
12 | UFO = myDataStore:GetAsync(player.UserId.. "-UFOCookie" ) |
13 | OOB = myDataStore:GetAsync(player.UserId.. "-OOBCookie" ) |
14 | Bacon = myDataStore:GetAsync(player.UserId.. "-BaconCookie" ) |
17 | shared.OriginalCookie = Original |
18 | shared.UFOCookie = UFO |
19 | shared.OOBCookie = OOB |
20 | shared.BaconCookie = Bacon |
23 | if Original = = nil then |
24 | shared.OriginalCookie = false |
27 | shared.UFOCookie = false |
30 | shared.OOBCookie = false |
33 | shared.BaconCookie = false |
42 | game.Players.PlayerRemoving:Connect( function (player) |
44 | local success, errormessage = pcall ( function () |
45 | myDataStore:SetAsync(player.UserId.. "-OriginalCookie" ,shared.OriginalCookie) |
46 | myDataStore:SetAsync(player.UserId.. "-UFOCookie" ,shared.UFOCookie) |
47 | myDataStore:SetAsync(player.UserId.. "-OOBCookie" ,shared.OOBCookie) |
48 | myDataStore:SetAsync(player.UserId.. "-BaconCookie" ,shared.BaconCookie) |
54 | print ( "Data save error." ) |
If you look specifically at the OOB saves, for some reason it always prints false when I do print(shared.OOBCookie), and the only way it can come up false is if there is an error, because no script anywhere sets those shared variables to false, they are either true or nil. Although, I don't get a warning in the output like I'm supposed to, and everything else saves fine. I also know that when I end the playing that shared.OOBCookie is true. Can somebody help me?