Plus I love DataStore2, a free tool gifted to the Roblox community by the Roblox community for even easier work with data stores as it caches data to ensure it isn't lost. The only problem in real games is how to decide when and what to load which can become very problematic if done wrong as memory leaks can occur (not cleaning up old data so new data is added over time and causes the server to degrade).
Thanks dude! You helped me overcome the hell of not understanding data stores. Can you also post a video explaining in more detail about data stores, such as what is pcall function and more?
to use pcall, do a variable that stores 2 variables at ones (no, not like this "local thing = {}" but like this "local success, errormessage") and then set those 2 variables to a pcall, and then put a function inside of it. if it errors, it sets success to false and errormessage to the error message. if not, it only sets success to true.
thanks for keeping it simple and sticking to the point, every tutorial I watched was just people giving awful explanations, trying to explain pcalls and other code separate from datastore overloading my brain
God bless your soul dude, i had so much problm saving stuff in my games, now i can do it peacefully instead of punching random words in my keyboard until it does something
Hey nice video, you helped a lot, suggestion: Could you make a video like this with datastores but instead it is where you buy something from a shop and the thing you bought saves in your inventory after you die and/or leave the game.
This was a very informative video and easy to understand. I am creating a game solo from scratch without any experience in coding and building just for fun and I have to say of all the tutorials and information I have found to help me along the way this is by far the best one yet. I appreciate it!
DataStores gave me hell as a newer scripter, but I can handle them pretty well now - my preferred method is to loop through the player’s descendants, saving their stats as IntValues, NumValues etc., and identifying them by their name and parent if necessary. Nice tutorial by the way.
I should add, though, that you should probably add a game:BindToClose(function() along with a wait() and your saving function to act as a catch-all, since Roblox Studio doesn’t always detect when you press the stop button.
thank you sooo much i wanted to learn more about datastores and i tought that if i followed this tutorial i would still make a lot of mistakes and bugs but i actually made it work
I'm trying to make an Incremental game on Roblox, this should help me a lot! I'm new to scripting, I thought of Parent to Child relationship between Instances too literally. I thought the Parent container couldn't be the Parent of the other Parent's children. Now I understand you can search anything if you reference the correct String Value.
I use profile service, because get and setAsync stops working after 200 players in your game in total. Profile Service is just a lot more reliable and it's great for server shut downs.
personally i use profileservice and it works great, finally i managed to master even this lol, even though i guess ima abandon game development, somehow it doesnt fit me, and probably its just fact i always got no game ideas to make, and i work alone ):
@@iamLudius Eh, it's really not that simple. Maybe if you are just using a simple cash system, and that is the only key you need to store. I would say the way you described it is DataStores at their simplest form. They can get much more complex.
@@imthebestmayne122 Ludius explained it in a simple way so that datastores are more approachable. Once you understand the fundamentals of datastores, that means the more "complicated" datastores aren't as complicated as they seem.
@@urnix69 gotta say I disagree with this. No disrespect either to you or the poster. Most of this information (and more) can just be read from the data store api page on the roblox documentation page. What is much harder is finding information about more complicated data stores. Look at somethibt like ProfileService or DataStores2. I guess this video helps understand it at a very rudimentary level, but nothing further than that.
guys heres an advice from me: dont make datastores saving only on leaving! Make it save every time coins change instead, because if its only when you leave, if you can drop coins in your game then you can make a dupe glitch on private servers basically player1 drops 5 coins to player2, player2 leaves and the 5 coins save, but player1 SHUTS DOWN his private server so the data doesnt save, so he has 5 coins again
@@AxajonOFFICIALits so simple, if you have an inventory system or currency just make it save every time it gets changed, like make a new function that runs whenever the value changes and when it does it sets your async and updates.
@@darkarcher908 saving player data everytime a value changes sound like a performance nightmare in any game with fast changing values and a decent amount of players.
They should make it so you could erase everything on game's datastore. Also I have been suffering trying to make a datastore thing, it really depends what you're trying to code.
I need a little bit of help to know if I understand it right. So for me to save data for each player, I would need to make a server script in which I would need to reference every script that is responsible for some kind of system logic in my game. For example, if I have scripts for inventory, currency, leaderboard, et cetera, I would need to first connect those scripts to server script that I will be using for a DataStore and make a table with those scripts inside my server script for DataStore. In simple words, I need to add every script that has to do something with things that need to be saved across sessions and places inside my game to one script that will save those data automatically for me as players join or leave the game..
Very good explanation, but I have 1 question. In this video you made a DataStore for coins, but I have more values to store, lets say for example Stamina, Strength or whatever it is, do I create a DataStore for each data ?
Hey man, I don't know if you'll ever read this, but I have a question about data stores. So like, I got a message from Roblox saying that someone requested for their data to be removed from my game, but I never used this data store thingy, so do you know by any chance if it was any error from Roblox or something?
Should we really use SetAsync for a system like that? Isn't it better to use UpdateAsync? I don't really understand what's the point of UpdateAsync compared to SetAsync
It's all fun and games until you try to datastore a custom item with 7+ values + a lot of other similar items, do you just write the same line of codes a quadrillion times?
As much as I'd like to help you and any other person that may need me, at the moment my schedule's packed, sorry man :[ But maybe I can help you through the dev calls inside the discord server?
ill pay 50 robux who will do working DataStore script (i have 3 values) i checked the 3 tutorials and all of these tutotials doesn't work (ChatGPT also didn't help me)
@@rakirat640 the video EXPLAINS it in an approcheable way. basically i had NO IDEA how datastore works, but after watching this video which showed examples of using numbers, i used my brain to think of the other ways i could use datastore based on the knowledge i had.
Bro wth every other video i saw on this was 30 mins and didn't work and this was 10 mins and it worked first try! Thank you so much!!! one problem that i have is that i dont know how to make multiple datas save Edit learned how to do it it was so easy! Just looked at a little bit of the documentations
is there something im missing? because ive been trying to get datastore working for a year now but nothing i do seems to work, i enabled studio to api, followed everything in the video but doesn't work
@@iamLudius How so? Would it be like: You declare a table like "playerData = {}" and then you would use table.insert(table, value) in the player connect function? Then call that table when the player leaves?
i always used to think learning data stores for me was going to be a nightmare, this man proved me wrong in 15 lines of code
Lol fr
Plus I love DataStore2, a free tool gifted to the Roblox community by the Roblox community for even easier work with data stores as it caches data to ensure it isn't lost. The only problem in real games is how to decide when and what to load which can become very problematic if done wrong as memory leaks can occur (not cleaning up old data so new data is added over time and causes the server to degrade).
47 lines not 15
Thanks dude! You helped me overcome the hell of not understanding data stores. Can you also post a video explaining in more detail about data stores, such as what is pcall function and more?
to use pcall, do a variable that stores 2 variables at ones (no, not like this "local thing = {}" but like this "local success, errormessage") and then set those 2 variables to a pcall, and then put a function inside of it. if it errors, it sets success to false and errormessage to the error message. if not, it only sets success to true.
thanks for keeping it simple and sticking to the point, every tutorial I watched was just people giving awful explanations, trying to explain pcalls and other code separate from datastore overloading my brain
God bless your soul dude, i had so much problm saving stuff in my games, now i can do it peacefully instead of punching random words in my keyboard until it does something
I watched videos for hours and didn't understand it but your 10 minute video was so simple and wall explained, thanks alot.
finally someone who EXPLAINS datastoring and not makes me copy their script
I only have one thing to say:
Thank you so much for explaining this, now I understand datastores.
thank you i've recently been struggling on data store and now after a lot of practice, i can make it from scratch!
That's great man! Keep up the good work and best of luck with your dev journey :]
w, i want to achieve that level
thank you so so much dude. thsi is a underrated video. i didnt understand this but you explained it so well!!
Hey nice video, you helped a lot, suggestion: Could you make a video like this with datastores but instead it is where you buy something from a shop and the thing you bought saves in your inventory after you die and/or leave the game.
Thanks man, I didn't get the logical behind datasave, but now it works
This was a very informative video and easy to understand. I am creating a game solo from scratch without any experience in coding and building just for fun and I have to say of all the tutorials and information I have found to help me along the way this is by far the best one yet. I appreciate it!
Honestly i don't understand why people think data store as something nightmarish. On the start it was annoying. Now it's nothing.
It actually gets so simple later on
whats the hardest thing in roblox scripting to grasp?
@@iamLudiuscan you help me with datastore?
@@ruprecht69probably mastering cframes since it requires deep mathimatical knowledge
@@ruprecht69probably oop once you grasp that you can pretty much do anything
thank you sir. Talking in a manner which noobs like me can understand
i like ur editing style great video i learned something from it
Really useful vid, I thought it was hard but it was actually easy, thx.
DataStores gave me hell as a newer scripter, but I can handle them pretty well now - my preferred method is to loop through the player’s descendants, saving their stats as IntValues, NumValues etc., and identifying them by their name and parent if necessary. Nice tutorial by the way.
I should add, though, that you should probably add a game:BindToClose(function() along with a wait() and your saving function to act as a catch-all, since Roblox Studio doesn’t always detect when you press the stop button.
thank you sooo much i wanted to learn more about datastores and i tought that if i followed this tutorial i would still make a lot of mistakes and bugs but i actually made it work
I'm trying to make an Incremental game on Roblox, this should help me a lot!
I'm new to scripting, I thought of Parent to Child relationship between Instances too literally.
I thought the Parent container couldn't be the Parent of the other Parent's children.
Now I understand you can search anything if you reference the correct String Value.
finally someone who explains the damn code
You just gained one sub! Best video I watched about datastore!
Thank you so much bro i was so confused abt data store and now it feels so simple
this dude literally makes the best roblox guides on yt
Aye thanks for the encouraging words bro, it really means a lot :]
Also thanks for the comment
Its amazing i can see my scripting has improved because 1 month ago i couldnt even undertsand anything of this and now i understand it
Wow, that's really easy. Thank you so much for the video!
The issue is, the Data I wanna store is on a localscript, the normal script data was incredibly easy to store
datastore viewer plugin goes hard
is it free
Nope
you can just learn datastore without needing any plugin
@@billybobjankens12 i did that
The only time its gonna be hell is when you have a lot of things to store
GetAsync is to check if the player is in the list and SetAsync is to set the players data
I use profile service, because get and setAsync stops working after 200 players in your game in total. Profile Service is just a lot more reliable and it's great for server shut downs.
I had never heard about this, but thanks for the heads up, I'll look into it :]
200players in a server
@@Chlrintruc Yeah, just read that. But It is still really inefficient to use when there are these adanced things out there (even bloxfruits uses it)
@@ChristPoster ok then I'll try to learn it.
@@ChristPosterdoes BloxFruit use Profile Service?
personally i use profileservice and it works great, finally i managed to master even this lol, even though i guess ima abandon game development, somehow it doesnt fit me, and probably its just fact i always got no game ideas to make, and i work alone ):
I've never really heard about Profile Service, but I'll take a look into it when I get the chance
"Datastore: A Sripter's Worst Nightmares Explained"
Meanwhile:
:GetAsync() and :SetAsync()
Literally, it's that simple, people tend to overthink it jajajaja
@@iamLudius Eh, it's really not that simple. Maybe if you are just using a simple cash system, and that is the only key you need to store. I would say the way you described it is DataStores at their simplest form. They can get much more complex.
@@imthebestmayne122 Ludius explained it in a simple way so that datastores are more approachable. Once you understand the fundamentals of datastores, that means the more "complicated" datastores aren't as complicated as they seem.
Just create a good module script
It works as well
@@urnix69 gotta say I disagree with this. No disrespect either to you or the poster. Most of this information (and more) can just be read from the data store api page on the roblox documentation page. What is much harder is finding information about more complicated data stores. Look at somethibt like ProfileService or DataStores2. I guess this video helps understand it at a very rudimentary level, but nothing further than that.
1:10
“right? right? right? right? 😂
guys heres an advice from me:
dont make datastores saving only on leaving! Make it save every time coins change instead, because if its only when you leave, if you can drop coins in your game then you can make a dupe glitch on private servers
basically player1 drops 5 coins to player2, player2 leaves and the 5 coins save, but player1 SHUTS DOWN his private server so the data doesnt save, so he has 5 coins again
bro can you please tell how we can do that properly?
@@AxajonOFFICIALits so simple, if you have an inventory system or currency just make it save every time it gets changed, like make a new function that runs whenever the value changes and when it does it sets your async and updates.
@@darkarcher908 saving player data everytime a value changes sound like a performance nightmare in any game with fast changing values and a decent amount of players.
They should make it so you could erase everything on game's datastore.
Also I have been suffering trying to make a datastore thing, it really depends what you're trying to code.
THANK YOU! ONLY YOUR DATA STORE WORKING!!!
this guy is extremely underrated
THANK YOU LUDIUS!! I LOVE YOU!! 😭
As a modeler, this was helpful.
I need a little bit of help to know if I understand it right. So for me to save data for each player, I would need to make a server script in which I would need to reference every script that is responsible for some kind of system logic in my game. For example, if I have scripts for inventory, currency, leaderboard, et cetera, I would need to first connect those scripts to server script that I will be using for a DataStore and make a table with those scripts inside my server script for DataStore. In simple words, I need to add every script that has to do something with things that need to be saved across sessions and places inside my game to one script that will save those data automatically for me as players join or leave the game..
Love you. Now i understand it. ❤
I still don’t understand them after watching 4 tutorials 😭
imagine how would it look like in c++
Thanks to you, I've figured out how it works
Datastores is just a pain and very repetitve to do because of failsaving and the log way to get data and trying to get every single data.. Who agrees?
a good day when ludius drops
Damn, this really means a lot to me, I'm glad you enjoy my content. And also thanks for the comment :]
@@iamLudius hell yeah I even bought that scripting book cause of you to get better for my game as well
Very good explanation, but I have 1 question. In this video you made a DataStore for coins, but I have more values to store, lets say for example Stamina, Strength or whatever it is, do I create a DataStore for each data ?
bestt explanation
I'm happy to hear that :]
I like your detailed explanation an i tried it in my obby game but it is not working can you please make a video on it? please
your games broken nothings getting saved
bro.. i finally understand it tysm
Everyone gangsta til roblox datastores go down
Hey man, I don't know if you'll ever read this, but I have a question about data stores. So like, I got a message from Roblox saying that someone requested for their data to be removed from my game, but I never used this data store thingy, so do you know by any chance if it was any error from Roblox or something?
tbh for me data store wasn't and isn't my worst nightmare cause 1st place for worst nightmare takes math and object oriented programming
i dont understand even though you explain it good , is this supposed to be for really new coding because im confused
Should we really use SetAsync for a system like that? Isn't it better to use UpdateAsync? I don't really understand what's the point of UpdateAsync compared to SetAsync
I think I am just ass at coding in this, I followed everything and rechecked everything and it still doesn't save....
honestly i just use chatgpt because i have no clue
(but all other scripts are hand written dw)
Tho the script u described wasn’t a really good script because if there’s an error the player won’t get the data at all which is bad
It's all fun and games until you try to datastore a custom item with 7+ values + a lot of other similar items, do you just write the same line of codes a quadrillion times?
i have a script where every second the leaderstats value goes up i did the datastore part now it freezes at 0
woah, thank you so much.
Oh tysm now i understood it 😭🙏🙏
Love your videos Ludius! I am looking for a scripter for a game I am working on. Would you be interested?
As much as I'd like to help you and any other person that may need me, at the moment my schedule's packed, sorry man :[
But maybe I can help you through the dev calls inside the discord server?
the start is sooo real
I want to do it in my poop simulator im think ing of using text label when u click the poop button u get 1+ poop
ill pay 50 robux who will do working DataStore script (i have 3 values)
i checked the 3 tutorials and all of these tutotials doesn't work
(ChatGPT also didn't help me)
but it says how to make it in the video!!
@@CyanNStuff it didnt work
@@rakirat640 did you put the script in serverscriptservice?
I’ll do it
@@rakirat640 the video EXPLAINS it in an approcheable way.
basically i had NO IDEA how datastore works, but after watching this video which showed examples of using numbers, i used my brain to think of the other ways i could use datastore based on the knowledge i had.
i got everything to work now i just dont know how to give myself money in my own game
question : HOW do i save Booleans?
Bro wth every other video i saw on this was 30 mins and didn't work and this was 10 mins and it worked first try! Thank you so much!!! one problem that i have is that i dont know how to make multiple datas save
Edit learned how to do it it was so easy! Just looked at a little bit of the documentations
is there something im missing? because ive been trying to get datastore working for a year now but nothing i do seems to work, i enabled studio to api, followed everything in the video but doesn't work
a year is mad, you need to do your own research and get more specific with how luau works if its been that long
@@roboket3524 its not exactly a year its just been on and off for the most part but ive been trying for a week and still can't figure it out
BRO I SWEAR IM DAMN MAD CUZ MY DATASTORE LITERALLY STOPS WORKING,AND I TRY TO FIX IT,1 HOUR LATER AND IT DIDNT WORK,I SWEAR ROBLOX IS DEAD 😡😡
well, idk why but it always says: DataStore can't be accessed from client why???
Because you can't save data on client
So much wrong with this video. You don't prepare in the event that a read/write fails. DataStores are scary because of the amount of edge cases.
but how do you save multiple values? that's where i get confused cause i have over 100 values
maybe try putting your values in a table and saving the table?
how can i make gui button that adds value to player datastore?
Let's say there is two data. Coins and Levels. How can you save both?
im pretty sure there is a more efficient way to do so then what im saying but just make 2 seperate datastores.
U can do that or just save put them both in a table and just save it to one single player data datastore
Put them both in a table before saving
@@iamLudius How so? Would it be like: You declare a table like "playerData = {}" and then you would use table.insert(table, value) in the player connect function? Then call that table when the player leaves?
i tried using this datastore script with a boolvalue, but it didn't work
is it work with modules engines?
alll i hear the word is "right"
I still dont get it😭
then rewatch it until you do thats the only way of learning 🤷♂️
@@Jxhsxn Nah, I stole a script instead🤑
Dude, you should talk about pcalls when talking about datastores, otherwise your viewers will have problems in their games
real
No matter how much I try this code isn't working
Nvm, fixed as soon as I posted this comment, I just put the playerRemoving function in the wrong order
stopped watching at "wait(1)"
Agreed
rookie
type stuff
That's wassup
i love datastores and hate anim and shi lol
I can relate
Real
w vid
This is way too easy 💀
you should speak slower, i needed to put the video on speed 0.75
i still dont get it, way too complicated, and half of your code i had to ask AI to help me fix it, and at the end it still doesnt work for me
kjk
You always boosting your algorithm with your comments jajaajaja
I appreciate it :]
kjk@@iamLudius
dude you talk so fast i dont understand nothing but good try
SECOND
That's wassup!
FIRST
That's what I'm talking about!
@@iamLudius yessir