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
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
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!
Was literally looking for one of these videos and have been following your tutorial. Youre awesome for that
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!
love the way you explain everything keep it up!
Thanks man your so underrated, you deserve more subs, keep up the good work!
W tutorial, you lowkey helping me keep up that content 💯
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!!!
this channel & video needs wayyy more hype!
finally. was waiting for this
You make the vid fun and understandable goated and underrated fr
Better than DevKing!
@premiumorangegaming5309
2 ай бұрын
True
@mwnda
2 ай бұрын
fr, dude says ummm after every other word lmao
@IlIlIllllllI
Ай бұрын
LMAO trueee@@mwnda
@RealAimYT
Ай бұрын
real
@CherryTree277
26 күн бұрын
Dont disrespect the goat like that.. his tutorials was back at 2019 when theres barely anythin on youtube
Thank you so much!!! i had a problem in my data, but this explanation help me so much!
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.
FINNALY!!!!! I now understand STUPID data stores after 3 years
Great work dude keep it up
The way you teach in these videos is just amazing to me ngl
Bro dropped this👑
yo I just love how this dude conceptualizes.
I really needed this thanks!
Wonderful!
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
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
3 ай бұрын
I am Brazillian aswell and i toltally agree
Amazing explaination
Good one man how about strings next like string.match string.split string.find
Many thanks✌️
Thy Hood only allow you to save 1 Shilling(other than that no datastore) but it still get popular.
WHAT A VIDEOS I LOVE U
Thanks buddy
im using player.UserId as key and sometimes i use TableName[player.UserId] or TableName[player.UserId].ValueName.Value , but this was really helpful! :)
Thank You , Now İ Can Make My DataStore Without Toolbox !!
I got an idea for vidoe: Make a toolbar/hotbar with draggable icons etc.
goooaaaattt
Crossing my finger this works(haven’t watched video yet)
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 } } } ]
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.
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
2 ай бұрын
right, I am trying to learn how to save and load someone's backpack
@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
Ай бұрын
@@imthebestmayne122 Please help me too. User is Supercool_dd
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.
Good Video, but if i can ask, how i can save player data of things, like the tycoon at start?
@Draco_Dev
Ай бұрын
I agree
W vid
a good use for remove async is when u ban players
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
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
2 ай бұрын
Thank you very much for the response!
43:47 I dont understand, what do i put inside the loop to save the data every 60 seconds?
i am brazilian and i loved your movie
@otterryy
2 ай бұрын
🍿
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
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.
Why do we return get async though? Why not just use get async on its own.
first
isnt using userId better for keys in datastore? if a player changes their username they would lose all of their data, for example
@BrawlDevRBLX
Ай бұрын
Correct! UserId cannot change for a user so that's better to use as a key.
when i try that increment async code it keeps saying "Unable to cast value to Object" can u help me with that?
@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
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
4 ай бұрын
datastore encourage kids to grind which is unhealthy.
@ItsVegaSama
2 ай бұрын
@@VeryProPlayerYesSir1122?
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
2 ай бұрын
author pls pin
this is a nightmare
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
2 ай бұрын
Are you trying to save numbers or strings (text)?
@ItsVegaSama
2 ай бұрын
Are you trying to save an IntValue?
@MrLightz
Ай бұрын
I'm having the same problem
I knew how to use data store and I got confused after this video :/
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
Ай бұрын
you might made the coins other Value than intValue make sure it is a intValue to accept the number
@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
Ай бұрын
@@abenex2175 pro I don't understand any thing when he made pCall() and started sitting functions like setAsync and updateAsync what pCall() is??
@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
Ай бұрын
@@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 ?
pcalls are confusing
Saving spot 20:19
WHERE IS SCRIPTS
This mf can teach math in fortnite terms