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

  Рет қаралды 18,674

BrawlDev

BrawlDev

Күн бұрын

DISCORD 📜
Join my Discord Community if you want scripting help, participate in events/challenges, and make friends!
/ discord
MEMBERSHIPS 🎁
Get Access To My Scripts + More Perks By Becoming a Channel Member! 👇
/ @brawldevrblx
ADVANCED ROBLOX SCRIPTING SERIES 🔴
• Roblox Advanced Script...
ROBLOX GUI TUTORIAL SERIES 🎨
• Roblox GUI Tutorial Gu...
BEGINNER ROBLOX SCRIPTING SERIES 🟢
• Roblox Beginners Scrip...
TWITTER / X 🐦
/ brawlbattlerblx
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-...

Пікірлер: 158
@BrawlDevRBLX
@BrawlDevRBLX Ай бұрын
🎁Get Access to my Scripts + More Perks by Becoming a Channel Member! 👇 www.youtube.com/@BrawlDevRBLX/join
@AdityaPlays.lolpanti
@AdityaPlays.lolpanti 4 ай бұрын
Thank You soo much. Finding such detailed explanation is really hard to find, all the resources on KZfaq 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
@carpybaraba 6 ай бұрын
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!
@nolanhairr
@nolanhairr 6 ай бұрын
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!
@vlogsquad7113
@vlogsquad7113 3 ай бұрын
Was literally looking for one of these videos and have been following your tutorial. Youre awesome for that
@thattarch
@thattarch 5 ай бұрын
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!!!
@Draco_Dev
@Draco_Dev 4 ай бұрын
Thanks man your so underrated, you deserve more subs, keep up the good work!
@DevDucksey
@DevDucksey 2 ай бұрын
literally the best datastore video I've seen, you explained it so well. Surprised to see you only have 5k subs
@s1nblitz
@s1nblitz 2 ай бұрын
this was literally the only datastore tutorial that i fully understood and wasnt way too convoluted thank you soo much, this will bring my games to the next level
@spike9946
@spike9946 6 ай бұрын
love the way you explain everything keep it up!
@ZeroCrypher
@ZeroCrypher 6 ай бұрын
W tutorial, you lowkey helping me keep up that content 💯
@ScriptFedora
@ScriptFedora 2 ай бұрын
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.
@becausewhynot9696
@becausewhynot9696 13 күн бұрын
OMG I've done like 5 different tutorials and yours is the first that worked, and it also makes a lot of sense! Thank you so much for this video, it did a really good job of explaining how datastores work :D
@Voipy
@Voipy 6 ай бұрын
finally. was waiting for this
@foexes
@foexes 4 ай бұрын
Thank you so much!!! i had a problem in my data, but this explanation help me so much!
@FlawLessPixel
@FlawLessPixel 3 ай бұрын
You make the vid fun and understandable goated and underrated fr
@elorapadilla3856
@elorapadilla3856 2 ай бұрын
this channel & video needs wayyy more hype!
@hobis_wife
@hobis_wife Ай бұрын
compared to other videos, this video cleared up any mud I had about data stores and now data stores seem pretty simple. thank you! :)
@Neproxan
@Neproxan 6 ай бұрын
The way you teach in these videos is just amazing to me ngl
@ElipsMakesGames
@ElipsMakesGames 4 ай бұрын
FINNALY!!!!! I now understand STUPID data stores after 3 years
@pr0doxz410
@pr0doxz410 6 ай бұрын
I really needed this thanks!
@stephen5070
@stephen5070 Ай бұрын
Hey man you're a good teacher on Roblox Lua coding, I understand more now! I'm trying to make Incremental Game in the Player's Gui, I've been struggling with it.
@ZyanFernando
@ZyanFernando 6 ай бұрын
Bro dropped this👑
@aidatoure2545
@aidatoure2545 Ай бұрын
Thank you so much !! I usually have difficulties to stay focus, but the way youre teaching coding really helps me a lot !!!! And i also want to learn more !!!
@cauasales32
@cauasales32 6 ай бұрын
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 6 ай бұрын
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 6 ай бұрын
I am Brazillian aswell and i toltally agree
@no-li4mr
@no-li4mr 5 ай бұрын
Great work dude keep it up
@ruify6799
@ruify6799 6 ай бұрын
Wonderful!
@LavaFool
@LavaFool Ай бұрын
I was finding it so difficult to wrap my head around datastores, yet upon finding your video everything finally makes sense. Thanks alot 💯
@justrandomgamer9490
@justrandomgamer9490 3 ай бұрын
yo I just love how this dude conceptualizes.
@Masqueradix
@Masqueradix 6 ай бұрын
Many thanks✌️
@user-lt2dc9eg8m
@user-lt2dc9eg8m 4 ай бұрын
Amazing explaination
@facelessmanruin
@facelessmanruin 6 ай бұрын
goooaaaattt
@King100Game
@King100Game 6 ай бұрын
Good one man how about strings next like string.match string.split string.find
@VeryProPlayerYesSir1122
@VeryProPlayerYesSir1122 6 ай бұрын
Thy Hood only allow you to save 1 Shilling(other than that no datastore) but it still get popular.
@ElCamaronda
@ElCamaronda 4 ай бұрын
WHAT A VIDEOS I LOVE U
@SpecialBloxIsAwesome
@SpecialBloxIsAwesome 29 күн бұрын
Rare underrated youtuber guys better than devking and many other scripting youtubers. Actually explains what the datastore store is doing, helped me a ton. Respect g 👊
@Kubulinka
@Kubulinka 6 ай бұрын
Thanks buddy
@3AM04
@3AM04 13 күн бұрын
This is by far the best video on data stores. You explain it very well 🎉
@kuanjarlo
@kuanjarlo Ай бұрын
HOLY CRAP I JUST REWATCHED THIS THE NEXT DAY AND I FINALLY GET THE LOGIC THANK U SM BRAWLDEV
@AnonymousRBLX
@AnonymousRBLX 2 ай бұрын
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.
@AndrewRoberts-ty9qy
@AndrewRoberts-ty9qy 2 ай бұрын
I have been having an issue that I’ve been trying to figure out to so long. My data store works fine, but when I publish an update from studio it seems to reset that date entirely not matter how much I try to fix it. Anyone know how to help? I am also still trying to find scripture to help me with my game.
@maxenbest_lol0153
@maxenbest_lol0153 6 ай бұрын
I got an idea for vidoe: Make a toolbar/hotbar with draggable icons etc.
@wolfANNN
@wolfANNN 6 ай бұрын
W vid
@soollz4072
@soollz4072 2 ай бұрын
im using player.UserId as key and sometimes i use TableName[player.UserId] or TableName[player.UserId].ValueName.Value , but this was really helpful! :)
@speedyg2295
@speedyg2295 22 күн бұрын
Good Video. Wish you would have added a version number of DataStore. So that in creating a game and you want to reset your numbers back to a brand new player starting over. You can just change that number. I have seen it before. But don't get the jist of how it works.
@Mr1Lito
@Mr1Lito 4 ай бұрын
43:47 I dont understand, what do i put inside the loop to save the data every 60 seconds?
@Scriptmath
@Scriptmath 5 ай бұрын
Thank You , Now İ Can Make My DataStore Without Toolbox !!
@gopark123
@gopark123 2 ай бұрын
so UpdateAsync will automatically retry if success is false and keep retrying until it's true?
@jstarandomdude
@jstarandomdude 16 күн бұрын
haven't watched the full video yet, but according to your timestamps you used setAsync, wouldn't updateAsync be better as it lessens data losses?
@JohnyBloxDev
@JohnyBloxDev 4 күн бұрын
what about the gui? like data gui? like if player touch the part and frame will visible and if player leave the game and join again the frame is still visible can you make that?
@CONHOOPER
@CONHOOPER 4 ай бұрын
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.
@YTMGK
@YTMGK Ай бұрын
Hi, thanks for the very informative video, I'm struggling a bit to get my head around this as I want to keep my userdata in a dictionary, and then just update the whole dictionary to datastor when the player leaves, or recall the whole dictionary when the player logs on. The first problem I run into is when I try to parent the leaderstats folder to my dictionary, and since this is a necessary first step I can't progress further. Any help would be much appreciated. Please let me know if I should add in my code.
@CONHOOPER
@CONHOOPER 4 ай бұрын
Why do we return get async though? Why not just use get async on its own.
@Jumpcraftt
@Jumpcraftt 6 ай бұрын
Good Video, but if i can ask, how i can save player data of things, like the tycoon at start?
@Draco_Dev
@Draco_Dev 4 ай бұрын
I agree
@MangoTheTamer
@MangoTheTamer 15 күн бұрын
Hey brawldev sometimes it doesn't save because the server shuts down too quickly how do fix that
@powerisnotforme
@powerisnotforme 7 күн бұрын
this is so confusing but i can't believe i actually made a save script that works TYSM bro 😭😭
@SPYLEXs
@SPYLEXs 4 ай бұрын
when i try that increment async code it keeps saying "Unable to cast value to Object" can u help me with that?
@RobloxStudioLoser
@RobloxStudioLoser 3 ай бұрын
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
@weirdwanderer
@weirdwanderer 3 ай бұрын
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 3 ай бұрын
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.
@juliovieira2129
@juliovieira2129 5 ай бұрын
i am brazilian and i loved your movie
@otterryy
@otterryy 4 ай бұрын
🍿
@AggelosKriaras-zq3eq
@AggelosKriaras-zq3eq 5 ай бұрын
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 5 ай бұрын
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 5 ай бұрын
Thank you very much for the response!
@Hectorien_
@Hectorien_ 6 ай бұрын
first
@imthebestmayne122
@imthebestmayne122 4 ай бұрын
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 4 ай бұрын
right, I am trying to learn how to save and load someone's backpack
@imthebestmayne122
@imthebestmayne122 4 ай бұрын
@@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 3 ай бұрын
@@imthebestmayne122 Please help me too. User is Supercool_dd
@darkbard7
@darkbard7 5 ай бұрын
a good use for remove async is when u ban players
@EpicPico0625
@EpicPico0625 6 ай бұрын
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 6 ай бұрын
datastore encourage kids to grind which is unhealthy.
@ItsVegaSama
@ItsVegaSama 4 ай бұрын
@@VeryProPlayerYesSir1122?
@happyperkiness746
@happyperkiness746 Ай бұрын
Do you have any recommendations for any good books on Roblox development?
@BrawlDevRBLX
@BrawlDevRBLX Ай бұрын
I’ve never read any books on Roblox development, but I’ve heard “Heath Haskins The Advanced Roblox Coding Book: An Unofficial Guide, Updated Edition” is a popular pick.
@ConstantDerivative
@ConstantDerivative 3 ай бұрын
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 3 ай бұрын
Correct! UserId cannot change for a user so that's better to use as a key.
@user-xo9fz2zt8m
@user-xo9fz2zt8m Ай бұрын
did it take me a while to understand yes, was it worth it, your god damn right it was
@FlocoOnTop
@FlocoOnTop 20 күн бұрын
Can you make a datastore that saves StarterCharacter clothes?
@Ambush715
@Ambush715 16 күн бұрын
datastores is a nightmare
@Ambush715
@Ambush715 25 күн бұрын
but thanks for the tutorial tho. i kind of get it. i just need some practice
@No_EffortWasTaken
@No_EffortWasTaken 5 ай бұрын
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 4 ай бұрын
Are you trying to save numbers or strings (text)?
@ItsVegaSama
@ItsVegaSama 4 ай бұрын
Are you trying to save an IntValue?
@MrLightz
@MrLightz 4 ай бұрын
I'm having the same problem
@zzainz
@zzainz Ай бұрын
hi there do you know how u can make it so if a player reaches a specific place for ex. i have a backrooms game and a player reaches level 2. how do i make it so that when they rejoin they spawn into level 2?
@konvro0
@konvro0 20 күн бұрын
You can save(PlayerLeaving) on which level the player is at the moment then add load on playeradded. Other script on playerAdeed if the value of current level == 2 they should get teleported there or something.
@zzainz
@zzainz 20 күн бұрын
@@konvro0 damn thank u bro
@gg-nv1mq
@gg-nv1mq 3 ай бұрын
I knew how to use data store and I got confused after this video :/
@nishantbista6353
@nishantbista6353 22 күн бұрын
how do make it so that the number doesn't increase by 10 instead it will save the number of cash u got?
@laffendk1317
@laffendk1317 17 күн бұрын
i was legit thinking the same thing but bro did you found out how pls tell me if you did
@WorstDeveloper
@WorstDeveloper Ай бұрын
Hmm interesting that async calls are awaited automatically.
@abenex2175
@abenex2175 3 ай бұрын
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 3 ай бұрын
you might made the coins other Value than intValue make sure it is a intValue to accept the number
@abenex2175
@abenex2175 3 ай бұрын
@@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 3 ай бұрын
@@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 3 ай бұрын
@@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 3 ай бұрын
@@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 ?
@Sam-gm8qf
@Sam-gm8qf 28 күн бұрын
"gonna get Very Very Very Very disorganised Very Very fast..." The famous words of BrawlDev aka BrawlBattle.
@Aropiction
@Aropiction Ай бұрын
Hello, may I know how to reset the data of all players? please
@garodueng
@garodueng 10 күн бұрын
Try looking into ListKeysAsync, you should be able to reset all the data with a for loop
@Obichniy_user
@Obichniy_user 4 ай бұрын
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 4 ай бұрын
author pls pin
@Ambush715
@Ambush715 3 күн бұрын
my brain cant handle this .. i need help 😭😭😭
@Kmisiekk
@Kmisiekk 4 ай бұрын
WHERE IS SCRIPTS
@Ken_Dev
@Ken_Dev 5 ай бұрын
Better than DevKing!
@premiumorangegaming5309
@premiumorangegaming5309 4 ай бұрын
True
@mwnda
@mwnda 4 ай бұрын
fr, dude says ummm after every other word lmao
@IlIlIllllllI
@IlIlIllllllI 4 ай бұрын
LMAO trueee@@mwnda
@RealAimYT
@RealAimYT 3 ай бұрын
real
@CherryTree277
@CherryTree277 3 ай бұрын
Dont disrespect the goat like that.. his tutorials was back at 2019 when theres barely anythin on youtube
@abenex2175
@abenex2175 3 ай бұрын
pcalls are confusing
@shitpost_xxx
@shitpost_xxx 5 ай бұрын
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 } } } ]
@tutorialistik
@tutorialistik 6 ай бұрын
this is a nightmare
@Ambush715
@Ambush715 22 күн бұрын
True:( It's fucking confusing
@fuducklol
@fuducklol 3 ай бұрын
This mf can teach math in fortnite terms
@Ambush715
@Ambush715 26 күн бұрын
datastores are fucking confusing
@Zoudotdfpuzogxgx
@Zoudotdfpuzogxgx 6 ай бұрын
Saving spot 20:19
@Dipi2608
@Dipi2608 5 күн бұрын
españa
Каха заблудился в горах
00:57
К-Media
Рет қаралды 3,9 МЛН
Smart Sigma Kid #funny #sigma #comedy
00:26
CRAZY GREAPA
Рет қаралды 21 МЛН
Зачем он туда залез?
00:25
Vlad Samokatchik
Рет қаралды 3,3 МЛН
Suphi's DataStore Module Basics - Roblox Scripting Tutorial
1:18:59
I Paid Fiverr Game Developers to Make the Same Game
10:25
BadGameDev
Рет қаралды 654 М.
How To Make Starting Scripting Much EASIER....
6:18
Bandicot
Рет қаралды 10 М.
METATABLES | What are they and how can we use them?
18:40
Crusherfire
Рет қаралды 16 М.
The cloud is over-engineered and overpriced (no music)
14:39
Tom Delalande
Рет қаралды 514 М.
Каха заблудился в горах
00:57
К-Media
Рет қаралды 3,9 МЛН