of     1   

#228416837Monday, December 04, 2017 4:37 AM GMT

I've never attempted to learn data stores, as I figured I would never create a successful game in need of data store. I'm just visiting the forum to see what other scripters have to say about data store before I go to the wiki, thanks.
#228417072Monday, December 04, 2017 4:47 AM GMT

#228417163Monday, December 04, 2017 4:51 AM GMT

People will tell you to pcall to avoid errors, and they will make it much harder than it needs to be. It's real simple. Here's how I do it for my games: sessionData = {} game.Players.PlayerAdded:connect(function(player) player.CharacterAdded:connect(function(char) end) -- end of character added -- let's get the data local success,data = pcall(function() PlayerDataStores:GetAsync(player.UserId) end) if not success then print("Roblox had an error loading data") player:Kick("ROBLOX could not load your save file! Please try again soon.") -- ideally this part would retry a few times, but I don't have the patience for that. else if not data then -- if they are a first-timer print("no data found for ",player.Name) sessionData[player.UserId] = defaultData -- give them a blank template PlayerDataStores:SetAsync((player.UserId),sessionData[player.UserId]) else print("data successfully found for ",player.Name) sessionData[player.UserId] = data end end player:LoadCharacter() end)
#228417234Monday, December 04, 2017 4:53 AM GMT

Ahh, thanks ^^^
#228417315Monday, December 04, 2017 4:56 AM GMT

Hold on real quick. I think I'm learning something here now. local success,data = pcall(function() PlayerDataStores:GetAsync(player.UserId) end) So here you call two functions (pcall and getasync), how do you know which order the values are returned in?
#228417641Monday, December 04, 2017 5:11 AM GMT

Pcall will return the success (true or false), and the message (if there is an error message), and then subsequently anything returned by the function within If success, it will omit returning the error message from what I can tell and just go straight into the returns of the function within.
#228418150Monday, December 04, 2017 5:35 AM GMT

data stores are easy define data store service add value to data store service read data store save value with a button or when player leaves the game
#228418170Monday, December 04, 2017 5:35 AM GMT

Thanks to all who contributed to this post.
#228418249Monday, December 04, 2017 5:40 AM GMT

or logical operator, i learned that if something doesnt return to true, or operators can check if the next works instead of using p call use or print(hi) or print(false)
#228418312Monday, December 04, 2017 5:43 AM GMT

No Data doesn't mean Error so that wouldn't really work
#228419260Monday, December 04, 2017 6:33 AM GMT

#228420094Monday, December 04, 2017 7:24 AM GMT

It's stylized as ROBLOX, type it however you want..
#228422674Monday, December 04, 2017 11:01 AM GMT

if you is really weeby you could do like local data while (pcall(function() data = ################ end)) do wait(1) end
#228425221Monday, December 04, 2017 1:58 PM GMT

Read the link I sent to you @Soy And yes, I’m really toxic
#228425484Monday, December 04, 2017 2:16 PM GMT

is pcall playercall?
#228425789Monday, December 04, 2017 2:35 PM GMT

"Protected Call"

    of     1