[SOLVED] Why is this DataStore code not working? It seems like the same as the video.
This question has been solved by the original poster.
Leaderstats saving and loading from AlvinBlox
01 | game.Players.PlayerAdded:Connect( function (player) |
04 | local leaderstats = Instance.new( "Folder" ) |
05 | leaderstats.Name = "leaderstats" |
06 | leaderstats.Parent = player |
09 | local Sips = Instance.new( "IntValue" ) |
13 | local success, value = pcall ( function () |
14 | return myData:GetAsync(player.UserId) |
19 | print ( "Data was loaded successfully" ) |
22 | Sips.Parent = leaderstats |
27 | game.Players.PlayerRemoving:Connect( function (player) |
29 | local success, errormessage = pcall ( function () |
30 | myData:SetAsync(player.UserId, player.leaderstats.Sips.Value) |
34 | print ( "Data was saved successfull!" ) |
36 | print ( "There was an error when saving data!" ) |