Data Stores - Roblox Scripting Tutorial

Поделиться
HTML-код
  • Опубликовано: 25 дек 2024

Комментарии • 77

  • @blestoo5894
    @blestoo5894 7 месяцев назад +29

    damn, your voice really changed since i saw you in 2016. Good work man! keep going.

    • @Sirbozo
      @Sirbozo 6 месяцев назад

      yeee

    • @Short1794
      @Short1794 5 месяцев назад +1

      who wouldve guessed lol

    • @gradientblob1014
      @gradientblob1014 5 месяцев назад +2

      Everyone heere is simply talking about his voice, however, that is a fundementally normal part about being a human. growing up, is one of it. the fact that you are commenditing on this vide osi very rude and very not sigma and htsi ssomething that awthat shoulndt aef aw;elkj awlekfj;wlkej ;lawf jsig

    • @flame-ry7ps
      @flame-ry7ps 3 месяца назад

      @@gradientblob1014 tf ?

    • @edgyman519
      @edgyman519 Месяц назад

      @@gradientblob1014 Testing if my reply goes through

  • @crooda3681
    @crooda3681 7 месяцев назад +3

    It's been 10 years I think when I watched your old tutorials, you made me a good luau scripter thank you

  • @edgyman519
    @edgyman519 7 месяцев назад +14

    Summary (if anyone has issue):
    - DataStore:GetAsync(plr.UserId, value) -- returns the value saved within that player's UserId, (will be nil if that player has no previous data saved) so you might want to save that particular value, as that player's leaderstats value or something
    - DataStore:SetAsync(plr.UserId, value) -- changes the value of the value saved within that player's UserId, so you might want to use the Players.PlayerRemoving event so that every time a player leaves, you can set their value as what they last had
    -pcall(function() -- so you basically wrap a function in a pcall to make that there is no data lost, while trying to send a request to roblox's DataStoreService

    • @AlvinBlox
      @AlvinBlox  7 месяцев назад +4

      almost. pcall just prevents your script from throwing an error if there’s a problem with the request

    • @edgyman519
      @edgyman519 7 месяцев назад +1

      ohh thanks for the heart and clearing that up for me!

    • @RedmanHarfire
      @RedmanHarfire 2 месяца назад

      i want to know something what is returning a value ????

    • @edgyman519
      @edgyman519 2 месяца назад

      @@RedmanHarfire Lets look at an example : Lets say we have a function that adds up numbers
      local function Add(num1, num2)
      Sum = num1 + num2
      return Sum
      end
      basically what you return, will become the value that you get from that function. In other words, if i was to write :
      local myNum = Add(2, 3)
      The value of Add(2, 3) would be 5, since the sum of the 2 numbers is returned. And therefore, myNum will he equal to 5.
      P.S : Hey man, data stores is a slightly more of an advanced topic, so I think it would be better for you if you watched alvin's beginner series videos on functions and returning values and all that, he explains it really well

    • @randomchannel2713
      @randomchannel2713 Месяц назад

      Why is mine giving > {...} in the output...
      This is my script:
      local DataStoreService = game:GetService("DataStoreService")
      local DataStore = DataStoreService:GetDataStore("DataStore1")
      local Template = {Coins = 50}
      game.Players.PlayerRemoving:Connect(function(player)
      wait(5)
      pcall(function()
      DataStore:SetAsync(tostring(player.UserId), Template.Coins)
      end)
      end)
      game.Players.PlayerAdded:Connect(function(player)
      pcall(function()
      local data = DataStore:GetAsync(tostring(player.UserId))
      print(data)
      end)
      end)

  • @TDGrowing
    @TDGrowing 7 месяцев назад +5

    Yes bro! Keep making these videos they help me so much. I get better and better every day because of you, like no joke they are so helpful. Please keep making more!

  • @scriptexd
    @scriptexd 4 месяца назад +1

    Welcome back alvin i see that you cameback hopefully you will post more tutorials for us. Keep up with the good work 😀😀

  • @Niestrat99
    @Niestrat99 7 месяцев назад +2

    Nicely explained as always, Alvin!

  • @kidnamedsolid3547
    @kidnamedsolid3547 7 месяцев назад +1

    This is one of the best Data Store tutorials I've seen, keep it up.

  • @SpecialBloxIsAwesome
    @SpecialBloxIsAwesome 7 месяцев назад +4

    Nice vid, had a problem with the data store stuffs... Thanks mate 👍

  • @xepicgamer3594
    @xepicgamer3594 7 месяцев назад +1

    i was really confused about this, watched this now i don't think i'll ever face a problem when making datastores!

  • @digery
    @digery 5 месяцев назад

    Thank you so much for making this tutorial! I’m still learning and this helped me a lot.

  • @jett27j30
    @jett27j30 2 месяца назад

    Always been my go to for scripting tutorials. I finally have grasped data stores with your tutorial after like 5 years of trying to learn scripting properly... only to learn about profile service and datastore2 😭Could you make a tutorial on that? Thanks for the amazing tutorials over the years by the way.

  • @tobyvr4658
    @tobyvr4658 7 месяцев назад +1

    You are such a good scripter. Amazing video, keep up the good work

  • @AnycubicKobra2
    @AnycubicKobra2 4 месяца назад

    Nice video!

  • @Gamergirl-Gaming-developer
    @Gamergirl-Gaming-developer 7 месяцев назад

    Nice video Alvin

  • @marctheepicest2838
    @marctheepicest2838 7 месяцев назад

    omgg ur back

  • @0nebloone
    @0nebloone 4 месяца назад

    I am going to read what i have written logically if there is an error. Thanks AlvinBlox 👍

  • @imthebestmayne122
    @imthebestmayne122 4 месяца назад

    Someone please correct me if I am wrong, but at 11:31 when he makes the deepcopy of the table, isn't he saving the non-copied table "Template" using SetAsync? Or is the premise that if you want to manipulate the data, it should be a deep-copied table?

    • @oleNikolic
      @oleNikolic 4 месяца назад

      Correct, Copying the template isnt done so he Could put it in the set async, it was for so you could use the data later.He Said hes doing it for safety and i will probably too. Now a nice way of using that deepcopied table would be by continuing the if Data == nil statement with else. That statement checks if its players First time joining the game, and if it is, it sets the players values to the values from any table you wrote(template),so if we Said else after it, it would basically mean, if they join for the second or higher time. And then you would write DataStore:SetAsync(Player.UserId,Template).Now you would also Need to have a way of making coins value or something else bigger trought the table. Also if u arleady know to make a leaderstats and some values in it for a game, i could teach you how to easily save it even after it has updated, you would Need to use game.Players.PlayerRemoving, which is a event which fires once the player leaves the game. So if u have any auestions ask😅Sorry for a long message

    • @imthebestmayne122
      @imthebestmayne122 4 месяца назад

      @@oleNikolic No, I actually know how to make a "DataStore". I am watching as many videos as I can to learn how to ACTUALLY make a DataStore, like from the "Implementing Player Data and Purchasing Systems" document on the Roblox API/Documentation. But unfortunately, there is no RUclips video that goes THAT in-depth, which I guess is to be expected. So I just siphon through these beginner tutorials to try and learn new things.

    • @aminjaw
      @aminjaw 2 месяца назад

      @@oleNikolic hey when i tried to print my points, it times the value by 3 and if i try print my money, it just says "nil". btw i replicated the exact code just a few changed to the template but i know what im doing. any help?

  • @theorderofthedarkoats3288
    @theorderofthedarkoats3288 5 месяцев назад +1

    I'm confused about how this saves the data. Whenever the person leaves what saves the data to the datastore? I can't get mine to work, I'm just trying to save a leaderstat.

    • @dereckhernandezrivera3473
      @dereckhernandezrivera3473 5 месяцев назад

      That's cause you have to use another script to call on the datastore

    • @theorderofthedarkoats3288
      @theorderofthedarkoats3288 4 месяца назад

      @@dereckhernandezrivera3473 scripting is so complicated 😭

    • @V3LATIC
      @V3LATIC 4 месяца назад

      ​@@theorderofthedarkoats3288fr

    • @CouldBeAnyone
      @CouldBeAnyone Месяц назад

      It dint work because this video din't show us how to save the data when player leaves the game, might aswell look into other video that shows how to

  • @b4stardlol
    @b4stardlol Месяц назад

    hey! how i do a countdown with data store? like, when you leave and rejoin the timers dont reset?

  • @ayyansinan_22
    @ayyansinan_22 7 месяцев назад

    alvinblox I have a question can you make a tutorial on how you can make throwable knife like how you can throw a knife in murder mystery 2
    I tried doing it my self but every time I do there's something missing im not sure what it is that's thanks!

  • @szymon8859
    @szymon8859 7 месяцев назад

    Hey man, keep the good work, but i need your help, i don't know how to make a simulator, i have the map build but i don't know how to do breakables, orbs, buying areas. I only have a pet system from your tutorial that are realy good btw, if you can responde if you make this series it would be nice!

  • @JackPlaysMinecraft575
    @JackPlaysMinecraft575 6 месяцев назад

    This is Useful but it would be More Useful if there was a Simple vid on How to save The Player's Coins

  • @CountD3stroyer69
    @CountD3stroyer69 5 месяцев назад

    but how can i like make that if u for example made a quest and earned coins it wills store and u can actually buy smth with the coins and they get minus but also the thing u bought will get stored

  • @Briizardsx
    @Briizardsx 5 месяцев назад +1

    Omg since when did we need to pay with USD to get plugins?? I can't afford Data store editor since USD is far superior than my currency 😭this is diabolical

    • @imthebestmayne122
      @imthebestmayne122 4 месяца назад +2

      It is extremely cringe. Though I am kind of glad in the long run, because I convinced myself that Moon Animator is NOT worth the $30 and instead learned Blender for animating.

  • @kidnamedsolid3547
    @kidnamedsolid3547 7 месяцев назад

    You should make a video explaining pcalls and xpcalls

  • @superstorm4228
    @superstorm4228 4 месяца назад

    What's the point of making the players userID a string?

  • @iceiceburr
    @iceiceburr 5 месяцев назад

    for some reason when i used this my data connected with someone elses but i joined on an alt and it wasnt connected for it

  • @ILEJOSTARGOJI713
    @ILEJOSTARGOJI713 7 месяцев назад

    Can you make a tutorial on lowering the camera in first person mode when you do the crouch mechanic?

    • @plodethtrello9687
      @plodethtrello9687 3 месяца назад

      Make a part that is at the height of the players head when the crouching anim plays and then when u use the keybind for crouch tween between the main camera and the part you created for the camera.

    • @CouldBeAnyone
      @CouldBeAnyone Месяц назад

      ​@@plodethtrello9687Works but changing camera offset is faster

  • @Chochie137
    @Chochie137 7 месяцев назад

    do you just reupload a new script version on the same topic every year, i swear you’ve made like five other videos like this one

  • @dereckhernandezrivera3473
    @dereckhernandezrivera3473 5 месяцев назад

    Mind posting the completed script in des i had to delete it cause you switched up too fast, and it was to gumbled

  • @imnot4chriss
    @imnot4chriss 7 месяцев назад

    accidentally clicked on the RUclips notification, wsp

  • @normalpup838
    @normalpup838 7 месяцев назад

    Your voice really changed since i last watched your videos 5 years ago 😅

  • @theam.9298
    @theam.9298 7 месяцев назад

    this is very useful

  • @superstorm4228
    @superstorm4228 4 месяца назад

    Why do you need a deepcopy function, can't you just do "Data = template:Clone()"

    • @CouldBeAnyone
      @CouldBeAnyone Месяц назад

      You cant clone a table, that only works for instances in workspace

  • @dizrods5609
    @dizrods5609 5 месяцев назад

    does it actually work though?

  • @saving_4_venti
    @saving_4_venti 7 месяцев назад

    HII I USED TO WATCH YOU WHEN I WAS 9

  • @izkrucker
    @izkrucker 6 месяцев назад

    Hey can we get the link to the plugin you used for the data viewing

    • @AlvinBlox
      @AlvinBlox  6 месяцев назад

      Added to the description.

    • @izkrucker
      @izkrucker 6 месяцев назад

      @@AlvinBlox thanks

  • @Air.shortss
    @Air.shortss 7 месяцев назад

    I’m here

  • @VerifiedSkim
    @VerifiedSkim 6 месяцев назад

    how did you make a deep copy

    • @AlvinBlox
      @AlvinBlox  6 месяцев назад

      Added to description

    • @SQU1D_LORD
      @SQU1D_LORD Месяц назад

      The link in the description does not help

  • @Nae_Him
    @Nae_Him 7 месяцев назад +1

    First

  • @TrapGTFins
    @TrapGTFins 7 месяцев назад

    First comment 😊

  • @OfficialMichaelTheCollector
    @OfficialMichaelTheCollector 7 месяцев назад

    Hey dude! Wanna collab?

    • @BlastedOreo123
      @BlastedOreo123 6 месяцев назад +1

      why would someone with 485k subscribetswanna collab with some kid with 350 subscribers🤣🤣🤣🤣🤣

    • @OfficialMichaelTheCollector
      @OfficialMichaelTheCollector 6 месяцев назад

      @@BlastedOreo123AY! WHAT DID YOU SAY???

  • @Nae_Him
    @Nae_Him 7 месяцев назад

    First