Thank You soo much. Finding such detailed explanation is really hard to find, all the resources on CZcams are either too old or not so detailed. It is really a shame that this video still does not have the views it deserves
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!
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
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.
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!
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!!!
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
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.
I started here but like 15 minutes in realized there's prerequisite information I'm missing and will now be going on an adventure to watch this full series, also subscribed because the way you teach this just clicks in my brain, Thank You!
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 👊
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 !!!
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.
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 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.
im using player.UserId as key and sometimes i use TableName[player.UserId] or TableName[player.UserId].ValueName.Value , but this was really helpful! :)
could you create two different functions inside a module script to handle the saving and loading of player data and then require it from a server script? Just to keep things more organized?
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.
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
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’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.
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.
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!
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?
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.
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?
yes, so create a value in the player, example “frame” and set it to 0, when the player touches the frame, set it to 1, and save that value, and also make in the frame script, for when the player joins, check to see if the frame value is one, and if it is open the frame, and save the “frame value” and there you go!
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.
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
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?
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?
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.
@@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
@@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 ?
local function DataStoreGrabber() local FailCounter = 1 local Success, ErrorMessage repeat Success, ErrorMessage = pcall(function() -- Your code here -- For example: someFunctionThatMightFail() end) if not Success then print("Error: " .. ErrorMessage) end FailCounter = FailCounter + 1 until Success or FailCounter > 5 if not Success then -- if it didn’t after 5 tries print("Failed after 5 attempts: " .. ErrorMessage) else -- if it got through print("Success!") end end
🎁Get Access to my Scripts + More Perks by Becoming a Channel Member! 👇
www.youtube.com/@BrawlDevRBLX/join
Thank You soo much.
Finding such detailed explanation is really hard to find, all the resources on CZcams are either too old or not so detailed.
It is really a shame that this video still does not have the views it deserves
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!
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! :)
I am Brazillian aswell and i toltally agree
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
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.
Was literally looking for one of these videos and have been following your tutorial. Youre awesome for that
Thanks man your so underrated, you deserve more subs, keep up the good work!
FINNALY!!!!! I now understand STUPID data stores after 3 years
3 years is mad😭😭😭
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!
literally the best datastore video I've seen, you explained it so well. Surprised to see you only have 5k subs
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!!!
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
bro after so many tutorials yours is the one that actually worked for me u explained it good, nice job!
love the way you explain everything keep it up!
compared to other videos, this video cleared up any mud I had about data stores and now data stores seem pretty simple. thank you! :)
Thy Hood only allow you to save 1 Shilling(other than that no datastore) but it still get popular.
W tutorial, you lowkey helping me keep up that content 💯
this is def the best explanation of datastores on CZcams
this channel & video needs wayyy more hype!
Bro dropped this👑
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.
I was finding it so difficult to wrap my head around datastores, yet upon finding your video everything finally makes sense. Thanks alot 💯
This is by far the best video on data stores. You explain it very well 🎉
Thank you so much!!! i had a problem in my data, but this explanation help me so much!
HOLY CRAP I JUST REWATCHED THIS THE NEXT DAY AND I FINALLY GET THE LOGIC THANK U SM BRAWLDEV
I started here but like 15 minutes in realized there's prerequisite information I'm missing and will now be going on an adventure to watch this full series, also subscribed because the way you teach this just clicks in my brain, Thank You!
Good Video, but if i can ask, how i can save player data of things, like the tycoon at start?
I agree
The way you teach in these videos is just amazing to me ngl
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 👊
yo I just love how this dude conceptualizes.
Better than DevKing!
True
fr, dude says ummm after every other word lmao
LMAO trueee@@mwnda
real
Dont disrespect the goat like that.. his tutorials was back at 2019 when theres barely anythin on youtube
i can easily say that i will be able to use datastores with ease from now on because of how wonderfully you explained
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 !!!
finally. was waiting for this
Good one man how about strings next like
string.match
string.split
string.find
What a complete video. GOAT
I really needed this thanks!
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.
Great work dude keep it up
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.
right, I am trying to learn how to save and load someone's backpack
@@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.
@@imthebestmayne122 Please help me too. User is Supercool_dd
I dont understand how the if success then part works, what is success?? how can it be true or not I just dont get it
You make the vid fun and understandable goated and underrated fr
Wonderful!
Amazing explaination
Many thanks✌️
im using player.UserId as key and sometimes i use TableName[player.UserId] or TableName[player.UserId].ValueName.Value , but this was really helpful! :)
could you create two different functions inside a module script to handle the saving and loading of player data and then require it from a server script? Just to keep things more organized?
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.
Playing catweb helped me on this video lol (It's a roblox block scripting game)
Thank You , Now İ Can Make My DataStore Without Toolbox !!
you 're better than TheDevKing ❤
when i try that increment async code it keeps saying "Unable to cast value to Object" can u help me with that?
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
datastores is a nightmare
goooaaaattt
"gonna get Very Very Very Very disorganised Very Very fast..."
The famous words of BrawlDev aka BrawlBattle.
WHAT A VIDEOS I LOVE U
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?
did it take me a while to understand yes, was it worth it, your god damn right it was
i am brazilian and i loved your movie
🍿
I got an idea for vidoe: Make a toolbar/hotbar with draggable icons etc.
Thanks buddy
a good use for remove async is when u ban players
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.
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
}
}
}
]
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.
Do you have any recommendations for any good books on Roblox development?
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.
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.
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!
Thank you very much for the response!
but thanks for the tutorial tho.
i kind of get it.
i just need some practice
this is a nightmare
True:(
It's fucking confusing
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?
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.
Hmm interesting that async calls are awaited automatically.
so UpdateAsync will automatically retry if success is false and keep retrying until it's true?
Hey brawldev sometimes it doesn't save because the server shuts down too quickly how do fix that
43:47 I dont understand, what do i put inside the loop to save the data every 60 seconds?
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?
yes, so create a value in the player, example “frame” and set it to 0, when the player touches the frame, set it to 1, and save that value, and also make in the frame script, for when the player joins, check to see if the frame value is one, and if it is open the frame, and save the “frame value” and there you go!
It's pretty good tutorial, but how you save player income per click?
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.
Can you make a datastore that saves StarterCharacter clothes?
i don't think you should use variable with the same name in the same scope, you're using success few times
W vid
Why do we return get async though? Why not just use get async on its own.
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
author pls pin
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?
datastore encourage kids to grind which is unhealthy.
@@VeryProPlayerYesSir1122?
isnt using userId better for keys in datastore? if a player changes their username they would lose all of their data, for example
Correct! UserId cannot change for a user so that's better to use as a key.
my brain cant handle this .. i need help 😭😭😭
datastores are fucking confusing
I knew how to use data store and I got confused after this video :/
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?
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.
@@konvro damn thank u bro
How would I set it without increasing it by ten. I gave myself 200 coins, but instead, I got 30 after loading back in can someone help
Thats strange, did you set your money while on the client? (I made that mistake One too many time back then...)
@@Triploonic thanks I got it to work
When I put this into my script it doesn’t save data the only thing it says value cannot be converted to a number
Are you trying to save numbers or strings (text)?
Are you trying to save an IntValue?
I'm having the same problem
how do make it so that the number doesn't increase by 10 instead it will save the number of cash u got?
i was legit thinking the same thing but bro did you found out how pls tell me if you did
Saving spot 20:19
This mf can teach math in fortnite terms
OH MY GOOOSHSHSHSHSHSSHSHSH TYSMM
Hello, may I know how to reset the data of all players? please
Try looking into ListKeysAsync, you should be able to reset all the data with a for loop
first
WHERE IS SCRIPTS
pcalls are confusing
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?
you might made the coins other Value than intValue make sure it is a intValue to accept the number
@@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
@@abenex2175 pro I don't understand any thing when he made pCall() and started sitting functions like setAsync and updateAsync what pCall() is??
@@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
@@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 ?
how do you do repeats tho?
local function DataStoreGrabber()
local FailCounter = 1
local Success, ErrorMessage
repeat
Success, ErrorMessage = pcall(function()
-- Your code here
-- For example: someFunctionThatMightFail()
end)
if not Success then
print("Error: " .. ErrorMessage)
end
FailCounter = FailCounter + 1
until Success or FailCounter > 5
if not Success then
-- if it didn’t after 5 tries
print("Failed after 5 attempts: " .. ErrorMessage)
else
-- if it got through
print("Success!")
end
end