DataStore (Saving Player Data, pcall(), Scopes) - Roblox Advanced Scripting #17 (2024)

📜Join my Discord Community if you want scripting help, give feedback, or just hang out:
/ discord
🔴Watch My Full Roblox ADVANCED Scripting Tutorial Series:
• Roblox Advanced Script...
🎨Watch My Full Roblox GUI Tutorial Series:
• Roblox GUI Tutorial Gu...
🟢Watch my BEGINNER Roblox Scripting Tutorial Series:
• Roblox Beginners Scrip...
🙂Roblox Profile:
www.roblox.com/users/14860886...
🐦Twitter/X:
/ brawlbattlerblx
🎁 Become a Patreon to Receive Exclusive Benefits!
/ brawldev
In this 2023-2024 Guide to Roblox Scripting for Advanced Developers, I will go through everything you need to know to continue scripting on Roblox!
My new mission is to have fun teaching everything I know from developing games on Roblox since 2016. We will dive into scripting concepts as basic as printing to as complicated as raycasting. For every episode of this series, I encourage you to do everything I do to gain experience and let it stick with you so that you can create the games you're passionate about on your own. Enjoy this series and remember: being a competent scripter takes time and effort so don't get discouraged if things get too tricky. Remember where your inspirations came from; if you can be a Roblox scripter, then anyone can!
Timestamps:
0:00 Intro
1:57 CONCEPTION
6:07 Enabling Studio Access
7:53 Accessing Data Stores
10:38 SetAsync()
11:23 GetAsync()
13:18 IncrementAsync()
15:14 RemoveAsync()
17:09 pcall
25:50 SetAsync() vs UpdateAsync()
31:28 Scopes
35:25 Saving Player Data
42:44 Optimization Tips/Limitations
Tags:
#roblox #robloxstudio #robloxscript #robloxscripting #robloxadvancedscripting #robloxdev #robloxdevelopment #robloxdeveloper #robloxprogramming #scripting #programming #gamedev #gamedevelopment #gamedeveloper #robloxtutorial #robloxscriptingtutorial
DOWNLOAD ROBLOX STUDIO HERE:
create.roblox.com
(On the left side under "Quick Links", click on "Studio" and download)
More Resources:
create.roblox.com/docs/cloud-...

Пікірлер: 105

  • @AdityaPlays.lolpanti
    @AdityaPlays.lolpanti2 ай бұрын

    Thank You soo much. Finding such detailed explanation is really hard to find, all the resources on KZread are either too old or not so detailed. It is really a shame that this video still does not have the views it deserves

  • @carpybaraba
    @carpybaraba4 ай бұрын

    i finished all the tutorials you have done in this series so far, and I really like your teaching strategy! Keep up the good work!

  • @vlogsquad7113
    @vlogsquad7113Ай бұрын

    Was literally looking for one of these videos and have been following your tutorial. Youre awesome for that

  • @nolanhairr
    @nolanhairr3 ай бұрын

    Thank you for making these videos! They're easy to follow and extremely helpful! I've watched dozens of other videos but the way you explained the content made it feel very approachable. Thank you!

  • @spike9946
    @spike99464 ай бұрын

    love the way you explain everything keep it up!

  • @Draco_Dev
    @Draco_DevАй бұрын

    Thanks man your so underrated, you deserve more subs, keep up the good work!

  • @ZeroCrypher
    @ZeroCrypher4 ай бұрын

    W tutorial, you lowkey helping me keep up that content 💯

  • @thattarch
    @thattarch2 ай бұрын

    i love your videos so much man, they have helped me to understand lua so much better and make me able to code things that i wouldn’t even have understood before watching your videos. you deserve so many more subs and you should definitely keep up the fantastic work!!!

  • @elorapadilla3856
    @elorapadilla3856Күн бұрын

    this channel & video needs wayyy more hype!

  • @Voipy
    @Voipy4 ай бұрын

    finally. was waiting for this

  • @FlawLessPixel
    @FlawLessPixelАй бұрын

    You make the vid fun and understandable goated and underrated fr

  • @Ken_Dev
    @Ken_Dev2 ай бұрын

    Better than DevKing!

  • @premiumorangegaming5309

    @premiumorangegaming5309

    2 ай бұрын

    True

  • @mwnda

    @mwnda

    2 ай бұрын

    fr, dude says ummm after every other word lmao

  • @IlIlIllllllI

    @IlIlIllllllI

    Ай бұрын

    LMAO trueee@@mwnda

  • @RealAimYT

    @RealAimYT

    Ай бұрын

    real

  • @CherryTree277

    @CherryTree277

    26 күн бұрын

    Dont disrespect the goat like that.. his tutorials was back at 2019 when theres barely anythin on youtube

  • @foexes
    @foexesАй бұрын

    Thank you so much!!! i had a problem in my data, but this explanation help me so much!

  • @ScriptFedora
    @ScriptFedora14 күн бұрын

    Finally a tutorial on Data saving that ACTUALLY WORKS. I cannot tell you how many tutorials i've seen with the same not working code and no explaining done. You honestly deserve A whole lot more views and subscribers than you have.

  • @ElipsMakesGames
    @ElipsMakesGamesАй бұрын

    FINNALY!!!!! I now understand STUPID data stores after 3 years

  • @no-li4mr
    @no-li4mr3 ай бұрын

    Great work dude keep it up

  • @Neproxan
    @Neproxan4 ай бұрын

    The way you teach in these videos is just amazing to me ngl

  • @ZyanFernando
    @ZyanFernando4 ай бұрын

    Bro dropped this👑

  • @justrandomgamer9490
    @justrandomgamer949021 күн бұрын

    yo I just love how this dude conceptualizes.

  • @pr0doxz410
    @pr0doxz4104 ай бұрын

    I really needed this thanks!

  • @ruify6799
    @ruify67994 ай бұрын

    Wonderful!

  • @cauasales32
    @cauasales324 ай бұрын

    You're amazing. I'm from Brazil, english is not my first language but your teaching skills are fenomenal. I can understand pretty much everythin without needing to go back in the video, your oratory it's just too good! Thanks for the video and keep up with the hard work!

  • @BrawlDevRBLX

    @BrawlDevRBLX

    4 ай бұрын

    Happy to hear that you like my explanations and teaching style! I hope you stick around for the many videos I have planned for the future! :)

  • @Avysilvasan

    @Avysilvasan

    3 ай бұрын

    I am Brazillian aswell and i toltally agree

  • @user-lt2dc9eg8m
    @user-lt2dc9eg8mАй бұрын

    Amazing explaination

  • @King100Game
    @King100Game4 ай бұрын

    Good one man how about strings next like string.match string.split string.find

  • @Masqueradix
    @Masqueradix4 ай бұрын

    Many thanks✌️

  • @VeryProPlayerYesSir1122
    @VeryProPlayerYesSir11224 ай бұрын

    Thy Hood only allow you to save 1 Shilling(other than that no datastore) but it still get popular.

  • @ElCamaronda
    @ElCamaronda2 ай бұрын

    WHAT A VIDEOS I LOVE U

  • @Kubulinka
    @Kubulinka4 ай бұрын

    Thanks buddy

  • @soollz4072
    @soollz40726 күн бұрын

    im using player.UserId as key and sometimes i use TableName[player.UserId] or TableName[player.UserId].ValueName.Value , but this was really helpful! :)

  • @Scriptmath
    @Scriptmath2 ай бұрын

    Thank You , Now İ Can Make My DataStore Without Toolbox !!

  • @maxenbest_lol0153
    @maxenbest_lol01534 ай бұрын

    I got an idea for vidoe: Make a toolbar/hotbar with draggable icons etc.

  • @facelessmanruin
    @facelessmanruin4 ай бұрын

    goooaaaattt

  • @Coreylavoie
    @Coreylavoie4 ай бұрын

    Crossing my finger this works(haven’t watched video yet)

  • @shitpost_xxx
    @shitpost_xxx3 ай бұрын

    Nice... but how do you manage dynamic JSON-like data? like: [ {"player1": { "inventory": [ { "item_id": 4, "qty": 50 }, { "item_id": 2, "qty": 4 } ] } }, {"player2": { "inventory": { "item_id": 5, "qty": 10 } } } ]

  • @CONHOOPER
    @CONHOOPERАй бұрын

    I think i get it now. Doesnt pcall return one value. True or false. That's success right? Then the second return value which is currentCoins depends on what you return in the function which in the case you did PlayerCoins:GetAsync(player.UserId) Correct me if im wrong.

  • @imthebestmayne122
    @imthebestmayne1222 ай бұрын

    I wish you gave more information about scopes. In most large projects, it won't be single values being saved, ie cash. The Documentation info about scopes is trash, and it is hard to know how to save large amounts of varying types of data, while being organized and concise. I also feel like leaderstats aren't a good indication of advanced data store usage either, considering as I stated earlier, most projects will not be saving just a few IntValues as data.

  • @ItsVegaSama

    @ItsVegaSama

    2 ай бұрын

    right, I am trying to learn how to save and load someone's backpack

  • @imthebestmayne122

    @imthebestmayne122

    2 ай бұрын

    @@ItsVegaSama Do you have an account on the devforum? I can send you a script I made to do that if you are interested? I can try and explain it in the comments, but it's probably too long for that.

  • @corruptedshadowz

    @corruptedshadowz

    Ай бұрын

    @@imthebestmayne122 Please help me too. User is Supercool_dd

  • @AnonymousRBLX
    @AnonymousRBLX3 күн бұрын

    Bro at 28:26 when he calls increkmentvalue, what do we put in the parentheses? I am getting an error message because I don't have anything in them.

  • @Jumpcraftt
    @Jumpcraftt4 ай бұрын

    Good Video, but if i can ask, how i can save player data of things, like the tycoon at start?

  • @Draco_Dev

    @Draco_Dev

    Ай бұрын

    I agree

  • @wolfANNN
    @wolfANNN3 ай бұрын

    W vid

  • @darkbard7
    @darkbard73 ай бұрын

    a good use for remove async is when u ban players

  • @AggelosKriaras-zq3eq
    @AggelosKriaras-zq3eq3 ай бұрын

    Should i declare a data store as "PlayerData" and set it as a huge table with diff types of data such as leaderstats settings inventory etc? Or should i separate the data into different datastores? Also in order to avoid any errors and data loss with pcall do the job? Thank you for the tutorial.

  • @BrawlDevRBLX

    @BrawlDevRBLX

    2 ай бұрын

    I would usually have a main datastore like "PlayerData" and I would use scopes to categorize the datastore like "Inventory", "Leaderstats", "Settings", "EquippedStats", etc. As for pcall, it guarantees a response if fetching the data fails, but it doesn't prevent it. You must take extra steps to retry the data fetching if it fails. There are examples of this online, but I hope this helps you!

  • @AggelosKriaras-zq3eq

    @AggelosKriaras-zq3eq

    2 ай бұрын

    Thank you very much for the response!

  • @Mr1Lito
    @Mr1LitoАй бұрын

    43:47 I dont understand, what do i put inside the loop to save the data every 60 seconds?

  • @juliovieira2129
    @juliovieira21293 ай бұрын

    i am brazilian and i loved your movie

  • @otterryy

    @otterryy

    2 ай бұрын

    🍿

  • @weirdwanderer
    @weirdwanderer25 күн бұрын

    43:33 Maybe I understood it wrong, but wouldn't updating the date every minute be bad? What if a player leaves before that minute sets in? Do we double-check it with Players.PlayerRemoving?

  • @BrawlDevRBLX

    @BrawlDevRBLX

    24 күн бұрын

    A mix of both is generally good for safety measure. The server could shut down abruptly, which wouldn't could towards the PlayerRemoving event and then progress would be lost. If you want to, you can change the wait time from 60 secs to something like 5 or 10 minutes.

  • @CONHOOPER
    @CONHOOPERАй бұрын

    Why do we return get async though? Why not just use get async on its own.

  • @Hectorien_
    @Hectorien_4 ай бұрын

    first

  • @ConstantDerivative
    @ConstantDerivativeАй бұрын

    isnt using userId better for keys in datastore? if a player changes their username they would lose all of their data, for example

  • @BrawlDevRBLX

    @BrawlDevRBLX

    Ай бұрын

    Correct! UserId cannot change for a user so that's better to use as a key.

  • @hccorre9465
    @hccorre9465Ай бұрын

    when i try that increment async code it keeps saying "Unable to cast value to Object" can u help me with that?

  • @RobloxStudioLoser

    @RobloxStudioLoser

    Ай бұрын

    Im not sure if you put a datastore into a object, and if you did, then it wouldnt work, also datastores are inside leaderstats scripts so you would open up your leaderstats script, press the + button and add another script which would be the datastore

  • @EpicPico0625
    @EpicPico06254 ай бұрын

    Question, why not make values in the game and when the player leaves, it sets the values to the datastore instead of directly setting the value to the datastore?

  • @VeryProPlayerYesSir1122

    @VeryProPlayerYesSir1122

    4 ай бұрын

    datastore encourage kids to grind which is unhealthy.

  • @ItsVegaSama

    @ItsVegaSama

    2 ай бұрын

    @@VeryProPlayerYesSir1122?

  • @Obichniy_user
    @Obichniy_user2 ай бұрын

    ANYONE, BEAR IN MIND!!! if your datastore isnt working (doesnt matter, yours or tutorial but it wrote right) you can publish your place to roblox and test yourdatastore script, someone have this bug (like me), this is a solution

  • @Obichniy_user

    @Obichniy_user

    2 ай бұрын

    author pls pin

  • @idxnull
    @idxnull3 ай бұрын

    this is a nightmare

  • @No_EffortWasTaken
    @No_EffortWasTaken3 ай бұрын

    When I put this into my script it doesn’t save data the only thing it says value cannot be converted to a number

  • @no-li4mr

    @no-li4mr

    2 ай бұрын

    Are you trying to save numbers or strings (text)?

  • @ItsVegaSama

    @ItsVegaSama

    2 ай бұрын

    Are you trying to save an IntValue?

  • @MrLightz

    @MrLightz

    Ай бұрын

    I'm having the same problem

  • @gg-nv1mq
    @gg-nv1mq27 күн бұрын

    I knew how to use data store and I got confused after this video :/

  • @abenex2175
    @abenex2175Ай бұрын

    did everything you did, but when i run it it says "value of type nil cannot be converted to a number" - can you help me please?

  • @Ahmed.Esmail2169

    @Ahmed.Esmail2169

    Ай бұрын

    you might made the coins other Value than intValue make sure it is a intValue to accept the number

  • @abenex2175

    @abenex2175

    Ай бұрын

    @@Ahmed.Esmail2169 nah, it fixed after I ran it by using game.players.playeradded, but didn't after characteradded idk why that's a thing

  • @Ahmed.Esmail2169

    @Ahmed.Esmail2169

    Ай бұрын

    @@abenex2175 pro I don't understand any thing when he made pCall() and started sitting functions like setAsync and updateAsync what pCall() is??

  • @abenex2175

    @abenex2175

    Ай бұрын

    @@Ahmed.Esmail2169 a pcall writes to 2 variables, first being a Boolean which checke if the function in the pcall was successful, and the 2nd outputs the potential error message if the pcall wasnt successful. If there's a return statement in the function, the output will go to the 2nd variable instead

  • @Ahmed.Esmail2169

    @Ahmed.Esmail2169

    Ай бұрын

    @@abenex2175 alright I understand that but why do he setAsync with pCall that doesn't mean if you collect coins at the game and get out then play the game again the value of coins will be the value he sitted and the coins you collected will be gone ?

  • @abenex2175
    @abenex2175Ай бұрын

    pcalls are confusing

  • @Zoudotdfpuzogxgx
    @Zoudotdfpuzogxgx3 ай бұрын

    Saving spot 20:19

  • @Kmisiekk
    @KmisiekkАй бұрын

    WHERE IS SCRIPTS

  • @fuducklol
    @fuducklolАй бұрын

    This mf can teach math in fortnite terms