My egg datastore isnt working, I tried everything, Why wont it work?
Asked by
4 years ago Edited 4 years ago
Here is my datastore. It didnt save my data at all or print anything
01 | local DataStoreService = game:GetService( "DataStoreService" ) |
02 | local NewData = DataStoreService:GetDataStore( "myDataStore" ) |
04 | game.Players.PlayerAdded:Connect( function (player) |
05 | local data = Instance.new( "Folder" ) |
09 | local eggs = Instance.new( "IntValue" ) |
14 | local success, errormessage = pcall ( function () |
15 | data = NewData:GetAsync(player.UserId.. "-eggs" ) |
21 | print ( "There was an error whilst loading your data" ) |
26 | game.Players.PlayerRemoving:Connect( function (player) |
27 | local success, errormessage = pcall ( function () |
28 | NewData:SetAsync(player.UserId.. "-eggs" , player.data.eggs.Value) |
34 | print ( "eggs not saved, error" ) |