Datastore is not saving saving changes in data despite no errors in output?
Asked by
5 years ago Edited 5 years ago
Hi I have been trying to code a data store and have run into an issue with the code I am trying to use
the script doesn't show any errors in the output bar, it just does not save any change in the data
so at this point I am at a loss for what to do
01 | local DSS = game:GetService( "DataStoreService" ) |
02 | local Players = game:GetService( "Players" ) |
03 | local Server = game:GetService( "ServerStorage" ) |
05 | local DS = DSS:GetDataStore( "Eldaronservertest1238" ) |
07 | Players.PlayerAdded:Connect( function (Player) |
09 | local UserId = Player.UserId |
10 | local Key = "KeyScope: " ..UserId |
11 | local MyData = DS:GetAsync(Key) |
12 | local Folder = Instance.new( "Folder" ) |
13 | Folder.Name = tostring (UserId) |
14 | local currency = Instance.new( "NumberValue" ) |
15 | Folder.Parent = Server |
16 | currency.Name = "Bitcoin" |
17 | currency.Parent = Folder |
19 | local Success, Err = pcall ( function () |
21 | currency.Value = MyData [ 1 ] |
28 | if Success then print ( "Success" ) |
30 | warn( "epic fail " ..Err) |
36 | Players.PlayerRemoving:Connect( function (Player) |
37 | local UserId = Player.UserId |
38 | local Key = "KeyScope: " ..UserId |
39 | local Folder = Server [ UserId ] |
40 | local Mydata = { Folder.Bitcoin.Value } |
42 | DS:GetAsync(Key, Mydata) |
43 | warn( "Player data saved for: " ..UserId) |