How to Make Working Datastores in 10 MINUTES | Roblox ProfileService Tutorial (Part 1)

DOWNLOAD THE CODE FROM THE TUTORIAL: www.patreon.com/user?u=86199064
Read our daily threads - / playvectorthree
ProfileService - create.roblox.com/marketplace...
How to use Module Scripts - • Learn Module Scripts i...
In this tutorial, learn to program with ProfileService, which has the primary benefit of session locking over DataStore2! Making Datastores is SUPER easy with this module and tons of the most popular games on Roblox use it. Rather than having to learn DataStoreService, you can quickly implement the code in this video and NEVER worry about data again...
ProfileService is made by Loleris, the creator of the Mad Murderer! Using this tool, you can learn how to save a player's data to make coin saving systems or save an inventory. This programming tutorial shows you how to make that process easy and how to quickly program datastore for all future games!
Subscribe to learn how to program and how to make games on Roblox!
Read more about ProfileService here- madstudioroblox.github.io/Pro...
VectorThree is an innovative company expanding the Roblox development education space. Want to work with us? Email!
jake@vectorthree.dev

Пікірлер: 279

  • @playDotProduct
    @playDotProduct Жыл бұрын

    What tutorial do you want to see next?

  • @pruzae

    @pruzae

    Жыл бұрын

    Good camera bobbing tutorial

  • @uxbyadrian

    @uxbyadrian

    Жыл бұрын

    Follow up to this video but how to make an inventory which shows your items and lets you drop them

  • @playDotProduct

    @playDotProduct

    Жыл бұрын

    @@uxbyadrian We have a tutorial on it using Datastore2 as our first upload, we'll likely release an updated version soon!

  • @HeIlcatSRT

    @HeIlcatSRT

    Жыл бұрын

    Wipe player data please

  • @MattRussellphotoshop

    @MattRussellphotoshop

    Жыл бұрын

    Would love to see how you build a tool shop with profileservice. So purchase a tool, update inventory, then clone the inventory back when player rejoins. Would also love to see how profileservice works with pet hatching.

  • @glegolas5008
    @glegolas5008 Жыл бұрын

    Bro, continue your amazing content. You have absolutely no clue how rare it is to come across such a great tutorial like this one.

  • @khaelou
    @khaelou Жыл бұрын

    Thanks for the well put together tutorial, I managed to revamp my existing implementation with this method and I can't be any happier knowing the player data will be there 😎

  • @shruum3d
    @shruum3d Жыл бұрын

    always impressed by how streamlined and easy to understand your videos are ! will definitely be looking into more complex methods for data organization :)

  • @playDotProduct

    @playDotProduct

    Жыл бұрын

    Thank you for the kind words!

  • @Ellttox

    @Ellttox

    6 ай бұрын

    @@playDotProductI think you forgot to say how you make the data load, cuz for me it only saves, but doesn’t load

  • @Ellttox

    @Ellttox

    6 ай бұрын

    and what if I have other values other than cash? How do I have those?

  • @fjnv

    @fjnv

    3 ай бұрын

    @@playDotProduct i think that was sarcasm

  • @AntiNuke_

    @AntiNuke_

    2 ай бұрын

    this dude doesnt explain anything, he's literally only saying what to do.

  • @Primiumy
    @Primiumy7 ай бұрын

    Great work, done much better than a lot of the tutorials out there.

  • @commxn
    @commxn11 ай бұрын

    I remember I used to watch your development streams on Twitch. Great to see you helping other developers like me with these tutorials!

  • @gewooncolinyt
    @gewooncolinyt Жыл бұрын

    This man needs to be paid alot for this work lmao. I knew nothing, absolutely nothing. I didnt even knew what "string" or "print" ment but thanks to this video i know alot more!

  • @pectron7647
    @pectron7647 Жыл бұрын

    Thank you SO MUCH it healped me a LOT

  • @r11154
    @r111545 ай бұрын

    You singlehandedly spoonfed me 5 hours worth of testing

  • @R1S1SKA
    @R1S1SKA7 ай бұрын

    Thank you so much! it really works and you explained it very clearly💥💥

  • @universalgames2901
    @universalgames29018 ай бұрын

    AMAZING!! Thank you so much! Also question, is there a way for inventories that I can add a subcategory to the item for the level of that item? Thanks!

  • @Idk-mk9cg
    @Idk-mk9cg Жыл бұрын

    Bro, never liked DevKing cuz he doesn't really know how to script and always get confused in his explanation, but, like only he had a lot of tutorials. Finally, found a nice replacement - it's you. Very nice explained and feels like you have an experience!

  • @Jmq123

    @Jmq123

    11 ай бұрын

    he is good at coding he is probably just not the best teacher

  • @not4eyesdev

    @not4eyesdev

    3 ай бұрын

    @@Jmq123 lol no he got everything off of dev resources and barely understood what he was doing himself. Might be different now but during his tutorial days they were most definitely just being straight up read off of dev resources

  • @Jmq123

    @Jmq123

    3 ай бұрын

    @@not4eyesdev good point

  • @ItzZoriun

    @ItzZoriun

    2 ай бұрын

    @@not4eyesdev idk what you've been seening but from all tdk's tutorials ive learned ALOT of scripting mostly using his advanced so tbh speak for urself

  • @not4eyesdev

    @not4eyesdev

    2 ай бұрын

    @@ItzZoriun Nah I definitely learned a lot from him too, in fact I've watched both the beginners and advanced series when I first started out, several times. But compared to other tutorials, his are really bad and stretched out. He made mistakes and barely knew what he's talking about. Simple errors took him way too long to figure out. If I remember correctly, he literally mentioned he just quoted stuff off of dev resources in some of his videos.

  • @GrandmanHepomegrante
    @GrandmanHepomegrante4 ай бұрын

    This is really good because if you better at C++ than lua u can chance the terms like C++

  • @xxxIncubusxxx
    @xxxIncubusxxx Жыл бұрын

    Thanks for your good tutorials. What's script's in your ServerStorage folder? Same names as in ServerScriptService. More explanation and examples for ProfileService saving method please.

  • @crimsreal
    @crimsreal Жыл бұрын

    Any idea if you would do a video on DataStore*2*? I am currently learning it as it seems more reliable, but I can't find a straightforward tutorial by searching, so I think it would help some people (including me). Aside from the question, good video! Your voice is very understandable and clear, and there's no cases of having to rewind to understand a word that you said. Keep going

  • @HowManySmall

    @HowManySmall

    Жыл бұрын

    it's not don't use it anymore

  • @playDotProduct

    @playDotProduct

    Жыл бұрын

    Thanks for the kind words! We'll get to work on that vid!

  • @playDotProduct

    @playDotProduct

    Жыл бұрын

    ProfileService does service its purpose quite well and has never had any reliability issues for myself

  • @tristontaute1357
    @tristontaute1357 Жыл бұрын

    Silly question possibly, but I am having trouble sending data over to the client to recieve and update. How would I go about that?

  • @farmandcarsimulations16
    @farmandcarsimulations16 Жыл бұрын

    Dude u just save me a headace, thank you

  • @SomeRandomPerson_IDK
    @SomeRandomPerson_IDK6 ай бұрын

    Is there a way I can call these from a different place? I want to make a kind of collectible that when you find it appears on the main menu. This really helped with other things though! Thanks!

  • @ultrab2777
    @ultrab277710 ай бұрын

    How would i add to the dataTemplate using another script? Like, adding a new variable, how would one go about adding "Cash" to that list, without it being there initially? So i can take an external table of items and add them to the dataTemplate as the user collects them?

  • @corruptghxst
    @corruptghxstАй бұрын

    This is perfect, just what I was looking for. A few questions about the type checking: Are Datastore values not able to be changed to different types? (such as changing var = 123 to var = "xyz") Does it also assert an error when overwriting a nil value? (changing var = nil to var = "xyz") I think I'd personally prefer to use that type checking within the Update() method to allow more freedom with the Set() method Also, is the getProfile() function in the Update() method necessary?

  • @Techies06
    @Techies0611 ай бұрын

    Hi @VectorThree, thank you for exposing me to the ProfileService module. It looks like a big improvement over what I have been experimenting with so far. I am struggling to make client-side calls to the ProfileService functions. Do I need to create a remote event to pull data for a GUI? im still trying to learn how a client-side script is supposed to get server-side data. If they are strictly local then do I need to create a local folder under the player that contains the data? I have successfully done it this way but it feels like it isn't secure. Any advice would be appreciated. thank you.

  • @Lowkey_Magiic

    @Lowkey_Magiic

    10 ай бұрын

    yes, use a remote event

  • @limeconez1074

    @limeconez1074

    10 ай бұрын

    I suggest making folders for individual players the replicated storage and add the data in the string values (By JSONencode) and it is easily accessible through the client.

  • @ily_oke
    @ily_oke11 ай бұрын

    I like how you created a Players variable but never used lmao. Anyways, good tutorial lol.

  • @Indramukyo1334
    @Indramukyo13348 ай бұрын

    you can explain how to do team database please ?

  • @nwhatchel
    @nwhatchel Жыл бұрын

    How would I store Tool objects for instance a hammer a character picks up, And would I place the tools in ServerStorage or ReplicatedStorage.

  • @gaggerblank1554
    @gaggerblank15546 ай бұрын

    Hi! First of all, great tutorial and this works really well! How would you :Get() and :Set() a profile with a player's UserId? My use case is that a player in my game might leave, and I need to record in their data that they have lost a match by forfeiting.

  • @catatrophicalist
    @catatrophicalist11 ай бұрын

    ik this video is 5 months old but do I have to understand all the code in the PlayerDataHandler or just understand how to use it?

  • @workesi2750
    @workesi275010 ай бұрын

    where do u put the profileserver script the link you put under your vedio and for what is it? '

  • @Vanquishtheabsolute
    @Vanquishtheabsolute9 ай бұрын

    im pretty bad at smth like this i have a question how can i save clothing so if i create my avatar and leave that it will save for the next time

  • @Ellttox
    @Ellttox6 ай бұрын

    I have been searching for a working tutorial the whole day already, non of the tutorials worked, in till I found this one! Thanks Edit: I have one question tho, you never said how to make the data load when the player joins the game so really all this data store does is save the data, but doesn’t load it. So could you pls make a vid on the other half of this tutorial?

  • @ttx_cb
    @ttx_cb7 ай бұрын

    How would i save folders and the items inside?

  • @thepenguinboy7831
    @thepenguinboy7831 Жыл бұрын

    if i want to save for example a clan do i save it on a number that holds value?

  • @kkkippy
    @kkkippy7 ай бұрын

    Is there somehow to get all the registered players from the ProfileStore?

  • @iTzAymen
    @iTzAymen8 ай бұрын

    i wish there was a similar tool for ordered data stores

  • @cad6n
    @cad6n Жыл бұрын

    How would I make an if statement using this? would it be something like if PlayerDataHandler(player, "Coins") == 0 then PlayerDataHandler:Set(player, "Coins", 100) end

  • @SadlekAski

    @SadlekAski

    Ай бұрын

    Just use get profile function Get the player profile like function something(player) local profile = DataHandler.GetProfile(player) (or its DataHandler:GetProfile(player), I dont remembr) if profile then profile.Data.Coins = profile.Data.Coins + 100 end end

  • @nuzuckugames
    @nuzuckugames Жыл бұрын

    I need help So I want to know how to display the values on a text label but dont know how

  • @dementiagaming_skill_issue
    @dementiagaming_skill_issue Жыл бұрын

    Hey! awesome video. learned alot from this! But i have a question, could i use the playerdatahandler in localscripts?

  • @janjoestar8757

    @janjoestar8757

    Жыл бұрын

    did you find out?

  • @Kysuto

    @Kysuto

    Жыл бұрын

    no, localscripts are only client sided so they dont store the data as safely

  • @SplixCreates
    @SplixCreates Жыл бұрын

    Thanks father

  • @mafnor2268
    @mafnor2268 Жыл бұрын

    i like that this doesnt use any instances and only tables :)

  • @ZiRR0
    @ZiRR0Ай бұрын

    thanks man

  • @0tt869
    @0tt86911 ай бұрын

    I have been looking for a good datastore for my new RPG and this one seems to be the right one.. I just finished typing the entire script and tomorrow I'll test out what this custom module can really do.

  • @0tt869

    @0tt869

    8 ай бұрын

    Update: Now I have a fully setup ProfileService as well with a ton of custom functions necessary for my game (but I had to use another tutorial since I was unfortunately struggling with this one for some reason) would recommend.

  • @DrDougan
    @DrDougan8 ай бұрын

    theres so many datastores is hard to figure out which one would be the go-to, you got "DataStore2" "Profile Service" "Suphis Data Store" and "Ordered DataStore", its very confusing, all i want is the one thats the best but not too hard to set up, for what i remember i think datastore2 handles all the player adding and removing and stuff compair to profile sevrer.

  • @imaSeraphRBX
    @imaSeraphRBX Жыл бұрын

    I've been using Datastore2 for quite a few years. I was wondering which module, in your opinion, is the better of the two.

  • @ajbeaver25

    @ajbeaver25

    Жыл бұрын

    ProfileService is better as it is safer to use and more up to date

  • @UnrealFlame
    @UnrealFlame11 ай бұрын

    nice, but how do you change the look of ur studio?

  • @omegabob-ul8ub
    @omegabob-ul8ub10 ай бұрын

    idk if i need to put inventory cuz i haven't implemented a pet system on my first clicking game yet so yes feel free to reply

  • @asshole124
    @asshole1248 ай бұрын

    Yoooooo how do you change the buttons?????

  • @KuboKumiko
    @KuboKumiko Жыл бұрын

    i followed your instruction but when i tried to play i get a message that i have been kick

  • @tak.o.5337
    @tak.o.53378 ай бұрын

    Alright so basically everything works ,except the fact that Ive no clue how to script a textlabel by using ProfileService to display the specified variable. For example a text to display the 'cash' value.

  • @Cardo2004
    @Cardo2004 Жыл бұрын

    Yo, I’ve been trying to make a shotgun that gets the position of the mouse and makes a linearVelocity to the player to bounce them back in the opposite direction in which they clicked….. And I don’t want to use the camera lookVector because it’s a side platformer and camera is locked to one position. Its not exactly working could you help or make a video???

  • @MwSama

    @MwSama

    Жыл бұрын

    I recommend u use mouse position and character position. Do (mousePosition - characterPosition).Unit to get the direction from mouse position to character position, like look vector. From there u can multiply it by negative 1 and use that value inside body velocity or something

  • @robloxthomasrandoms573
    @robloxthomasrandoms573 Жыл бұрын

    Is there a way to make it so you earn cash when your vehicle parks fully in a highlighted area or even just touches a sertain part? If so could you please explain how? Or if possible could you make a tutorial video on it?

  • @ICM9

    @ICM9

    10 ай бұрын

    Have a script that checks if all wheels of the vehicle are touching the area. While it is, make it loop every second, add 1 to whatever you are using to store your cash value.

  • @ICM9

    @ICM9

    10 ай бұрын

    Could use front and back of the vehicle as well, rather than wheels. Any parts so that when they’re within the boundary, it means the whole vehicle is.

  • @robloxthomasrandoms573

    @robloxthomasrandoms573

    10 ай бұрын

    @@ICM9 alright thanks 👍

  • @zkyler_zhavia
    @zkyler_zhavia Жыл бұрын

    i got an problem I need to change the coin script to if you kill someone PLS

  • @v0fty167
    @v0fty167 Жыл бұрын

    hey why am I getting kicked even though it says data will be saved, and it doesn't print

  • @Hafd_Entertainment
    @Hafd_Entertainment4 ай бұрын

    my get function some times gives an error and sometimes not any ideas?

  • @KoreanLobster
    @KoreanLobster7 ай бұрын

    hello i made a new dataTemplate and named it Keybinds I'm haveing some issues because when I add a key to Keybinds I get an error in output saying ServerScriptService.PlayerDataHandler:85: Data does not exist for key: Jump

  • @KoreanLobster

    @KoreanLobster

    7 ай бұрын

    i also added Keybinds to the profilestore local ProfileStore = ProfileService.GetProfileStore( "PlayerProfile", dataTemplate, Keybinds ) local dataTemplate = { Cash = 0, Inventory = {}, } local Keybinds = { Jump = "Enum.KeyCode.W" }

  • @yumemidroplet8716
    @yumemidroplet871616 күн бұрын

    how do i display the amount of cash on a gui?

  • @360sauce7
    @360sauce7 Жыл бұрын

    Could you do a Profile Service with saving items? I've looked everywhere and even tried doing it on my own( I looped though a player's backpack and put it inside a table) but failed.

  • @ImmortalSpelldagger

    @ImmortalSpelldagger

    Жыл бұрын

    Save The Items names as an Array Table, and when the player joins get the array and loop through it and duplicate the items and put it in the player backpack, make sure to add warns if player item isnt in the itemduplicates folder then redo it for respawning, while leaving Loop through player backpack, So like have a empty table and do table inserts with the item name and set it in player data (idk how to script it lol so im using text)

  • @SwiftlySev

    @SwiftlySev

    Жыл бұрын

    @@ImmortalSpelldagger just use for i,v in pairs with the data saved and also the folder where all items are stored. Make the for i,v check for items with the same name, and duplicate those items placing them into the backpack.

  • @ImmortalSpelldagger

    @ImmortalSpelldagger

    Жыл бұрын

    @@SwiftlySev thats what i said bruh

  • @360sauce7

    @360sauce7

    Жыл бұрын

    that doesnt work :(

  • @ImmortalSpelldagger

    @ImmortalSpelldagger

    Жыл бұрын

    @@360sauce7 skill issue

  • @ieananjum9676
    @ieananjum96764 ай бұрын

    how would u detect changes? say you wanted a coins gui how would you know when to update the coins for the client

  • @jstarandomdude

    @jstarandomdude

    3 ай бұрын

    im no scripting pro but im sure it has to do with something like coin.changed or sum

  • @nepyxl7057
    @nepyxl7057 Жыл бұрын

    Can I add two of the values together?

  • @northChain
    @northChain8 ай бұрын

    How can we reset data?

  • @Boeufplume6771
    @Boeufplume6771 Жыл бұрын

    Hi! can you do a tutorial on MemoryService. I'm struguling to do a matchmaking thing

  • @playDotProduct

    @playDotProduct

    Жыл бұрын

    We will get to work!!

  • @Boeufplume6771

    @Boeufplume6771

    Жыл бұрын

    @@playDotProduct Tysm!

  • @electroncat
    @electroncat9 ай бұрын

    I got an error "ServerScriptService.PlayerDataHandler:19: attempt to index nil with 'UserId' - Server - PlayerDataHandler:19". How do I fix this?

  • @manicbot

    @manicbot

    2 ай бұрын

    hey just checking if you've been able to fix it, getting the same problem rn

  • @xzuao4308

    @xzuao4308

    2 ай бұрын

    @@manicbot what did you write on that specific line of code that caused the error?

  • @bedinski
    @bedinski2 ай бұрын

    Can you please show how to do this but with a button GUI?

  • @Bucks-ni2lg
    @Bucks-ni2lg Жыл бұрын

    i'm really tired.what should i do if instead of my player's UserId, i get returned nil? console show up the error ServerScriptService.PlayerDataHandler:63: invalid argument #2 to 'format' (string expected, got nil) . i tried to print my player's userId, it also sent me nil

  • @capeknows9804

    @capeknows9804

    Жыл бұрын

    what does your script look like

  • @Stas-ON
    @Stas-ON9 ай бұрын

    i know im hella later, but can you pleasee make a tutorial on invoke server so you can display it on a text label? im subbed pls?

  • @Stas-ON

    @Stas-ON

    9 ай бұрын

    nevermind i already made it, its honesly really easy and thank you you are the best

  • @user-rg7fx6yc1s

    @user-rg7fx6yc1s

    Ай бұрын

    @@Stas-ON how do you display it on a text label,i cant access the module in a local script

  • @KilianS.
    @KilianS. Жыл бұрын

    How would you save a the value of a Part of a Table like : Cool = { Yes = 1, No = 2, }, PlayerDataHandler:Set(player,"Cool".Yes,10) ??????????????? that doesnt seem to work

  • @0tt869

    @0tt869

    11 ай бұрын

    Hey there It looked like in the video he added {} to the items that he wanted to put to the Inventory

  • @birdsghost
    @birdsghost3 ай бұрын

    Thx 🙏🏻🖖🏻

  • @bblockaa
    @bblockaaАй бұрын

    Hi, Im confused. The data does save but I want it to become a leaderstat. How should I go about doing that?

  • @jstarandomdude

    @jstarandomdude

    21 күн бұрын

    make a leaderstat script as usual but for the values just get the value from the profile service

  • @ItsNotTheAlt
    @ItsNotTheAlt5 ай бұрын

    How can i change string values inside it?

  • @wallop560
    @wallop560 Жыл бұрын

    Bruh, if it wasn't for this tutorial, I probably wouldn't have even known this was a thing

  • @Lowkey_Magiic
    @Lowkey_Magiic10 ай бұрын

    how would i use leaderstats with this?

  • @dlrty5584
    @dlrty5584 Жыл бұрын

    im confused on how i use this with my leaderstats i have made

  • @whosross
    @whosross6 ай бұрын

    how do I integrate this w/ leaderstats

  • @guttenpaapuchen
    @guttenpaapuchen Жыл бұрын

    Hello,on line 36 when it prints, it does not print the table but the key.

  • @furniture2322

    @furniture2322

    Жыл бұрын

    Same here. Any chance you found a fix for this?

  • @yarik_superpro
    @yarik_superpro5 ай бұрын

    you better make own system.The best practise is to auto save data of each player with 7 seconds delay and loop through each player then repeat again

  • @indiedevdevdev1585
    @indiedevdevdev1585 Жыл бұрын

    how to i get the module from local script

  • @slydisaster423
    @slydisaster423 Жыл бұрын

    Why would my GetProfile function be throwing nil? This video came out while ago is it just outdated if the profiles aren't being applied to new players ServerScriptService.PlayerDataHandler:54: attempt to index nil with 'UserId' - Server - PlayerDataHandler:54 13:42:46.153 Stack Begin - Studio 13:42:46.153 Script 'ServerScriptService.PlayerDataHandler', Line 54 - function GetProfile - Studio - PlayerDataHandler:54 13:42:46.153 Script 'ServerScriptService.PlayerDataHandler', Line 62 - function Get - Studio - PlayerDataHandler:62 13:42:46.153 Stack End - Studio

  • @panorocks1819

    @panorocks1819

    Жыл бұрын

    same

  • @universalgames2901

    @universalgames2901

    8 ай бұрын

    theres a comment up there to fix it. its not outdated just an error in his script

  • @gamergasen8732
    @gamergasen8732 Жыл бұрын

    Nice video😁😁👌👌

  • @felixmichel6616
    @felixmichel661611 ай бұрын

    Hello everyone, I have a question, since this module script is in the ServerScriptService, how do I do if I want for example display the players gold in a GUI ? Tanks in advance for your help

  • @thejadeflame8429

    @thejadeflame8429

    10 ай бұрын

    I am trying to do exactly that! Let me know if you figured it out please.

  • @0tt869

    @0tt869

    10 ай бұрын

    U can run a runservice on a separate serverscript, basically setting your intvalue to your current gold then do the scripting in the gui to check for the int value thats what i did using profileservice its just my setup is different

  • @Jay-qd7ib

    @Jay-qd7ib

    6 ай бұрын

    Well usually your gold is a leaderstat. So you would just set the gold to always be the value of the leaderstat

  • @Cyrus_04
    @Cyrus_049 ай бұрын

    My profile apparently doesn't exist while playtesting in Studio. Is this the ProfileService module's fault?

  • @playDotProduct

    @playDotProduct

    9 ай бұрын

    Game Settings -> Enable studio access to api services

  • @Cyrus_04

    @Cyrus_04

    9 ай бұрын

    @@playDotProduct already was on to begin with

  • @subscheme
    @subscheme Жыл бұрын

    I got the base working but when I try to make a table of items in data and add items every time I rejoin all my stats reset

  • @subscheme

    @subscheme

    Жыл бұрын

    nevermind i just had the studio datastore thing off thanks for the tutorial the system works great!!

  • @subscheme

    @subscheme

    Жыл бұрын

    hey I made this function for playerdatahandler function PlayerDataHandler:Reset(player) Profiles[player].Data = dataTemplate end for some reason when I call it the first time it works but after that it just doesn't work even though the function gets called

  • @vally16
    @vally16 Жыл бұрын

    How would you make a value increment up by 1 every second?

  • @devshark1

    @devshark1

    Жыл бұрын

    while wait(1) do ModuleName:Update(player, "ValueName", function(currentValue) return currentValue + 1 end) end should work, only works in script and not local script

  • @Thelittlesthoboson
    @ThelittlesthobosonАй бұрын

    I've been stuck for days on trying to save Inventory = { Coins = 1,} for example. I've figured out tons of ways to modify the value, but it NEVER saves the value. It always reverts to the default value. profile.Data.Values.Coins += amount changes it and i can see that if i print the data table, but when i leave and rejoin it goes back to the default value of when profiles are initialized

  • @Thelittlesthoboson

    @Thelittlesthoboson

    Ай бұрын

    oh my goodness. so i decided to look through the ProfileService and at the top i noticed... My tables were mixed due to messing around with values saving and such for fun.... So if your table values aren't saving! this is probably why :) I feel so silly now lol ! Do not create mixed tables (some values indexed by number and others by string key), as only the data indexed by number will be replicated.

  • @cjtimel.

    @cjtimel.

    24 күн бұрын

    @@Thelittlesthobosondo you know how to make it a leadersrat?

  • @heinzdoof8310
    @heinzdoof83106 ай бұрын

    Should I store playerdatamodule in replicatedstorage? localscripts cant acess the module in serverscript service.

  • @playDotProduct

    @playDotProduct

    6 ай бұрын

    Local scripts should not be able to change/access the true data module

  • @heinzdoof8310

    @heinzdoof8310

    6 ай бұрын

    @@playDotProduct How should I change it? Should I use a Remote Event that Passes The "Item", and the Quantity to a serverscript and update it through there?

  • @playDotProduct

    @playDotProduct

    6 ай бұрын

    You can update values on the server (such as Intvalue) to represent the data as a readonly option on the client, or you can use remote events/invoke remote functions@@heinzdoof8310

  • @loe4366
    @loe4366 Жыл бұрын

    While adding values to table, I want to add them like { -- Some random pet id = pet name 63826383 = Monkey, 53736387 = Lion, 63826386 = Lion, } How can I do that? I don't wanna use table.insert()

  • @resurrection4449

    @resurrection4449

    Жыл бұрын

    You can do something like this: local monkeyID = 63826383 local table = {} table["Monkey} = monkeyID This will insert a new value into the table without using table.insert()

  • @user-xt7eb7rj4d
    @user-xt7eb7rj4d11 ай бұрын

    I just finished typing this out and it didn't, work can someone please copy and paste for me please because I think it was just my code

  • @user-uw2gm5qx7v
    @user-uw2gm5qx7v4 ай бұрын

    for the errors n shit i js used if Profiles[player] then -- start of every function end -- after the return or whatever end of the function local function getProfile(player) if Profiles[player] then assert(Profiles[player], "Profile does not exist ".. player.UserId) return Profiles[player] else print("player left? function = getProfile(player)") end end u dont need the else print("player left? function = getProfile(player)")

  • @kcatholywater7134
    @kcatholywater71347 ай бұрын

    How to extract items tho

  • @stefanopiani9135
    @stefanopiani91356 ай бұрын

    I need help. Everytime i join my data gets loaded but it doesn't show on the leaderstats so I tried creating a function that gets called when the profile is created or loaded for a player. Tho for some reason this doesn't work. I tried using another script that creates the leaderstats but it says that the profile doesn't exist but maybe it is because it gets activated before the PlayerDataHandler does, so i tried delaying the activation but it simply cannot find the functions Set, Get and Update inside PlayerDataHandler and I cannot get my data. I even have another issue. When I use an Update function, to add coins as an example, it works but for some reason when I leave the game I get the error: "Profile does not exist for [player id]". Please I just want to load my data to the leaderboard when the player joins but I cannot do that apparently. P.S: Apparently every PlayerAdded script cannot use PlayerDataHandler functions and gives me only errors. I can activate them only with Touched events or Proximity Prompts.

  • @Fujui

    @Fujui

    5 ай бұрын

    Loop thru the plrs and run the func

  • @stefanopiani9135

    @stefanopiani9135

    5 ай бұрын

    @@Fujui Oh thank you, tho i already found a way for this. I used the template from the delevoper forum and transformed it into a module and I added a function for the leaderboard. It works fine now.

  • @jstarandomdude
    @jstarandomdude3 ай бұрын

    How to reset data like lets say i wanna reset everyones data, in datastores id just change the name of the datastore its saving too

  • @bikereh8333

    @bikereh8333

    2 ай бұрын

    yes

  • @DimU-dt2nv
    @DimU-dt2nv8 ай бұрын

    This is more harder than other databases bruh 💀💀💀

  • @phonk_paradise_
    @phonk_paradise_10 ай бұрын

    Init is not a valid number of a ModuleScript :(

  • @Generic_person
    @Generic_person Жыл бұрын

    Could I have some help. my code keeps on spewing out this error everytime I try and run it ServerScriptService.PlayerDataHandler:18: attempt to index nil with 'UserId'. the specific line of code is : local profile = ProfileStore:LoadProfileAsync("Player_"..player.UserId). any help would be greatly appreciated

  • @Generic_person

    @Generic_person

    Жыл бұрын

    this is my full code: local PlayerDataHandler = {} local dataTemplate = { Points = 0, } local ProfileService = require(game.ServerScriptService.ProfileService) local Players = game:GetService("Players") local ProfileStore = ProfileService.GetProfileStore( "PlayerProfile", dataTemplate ) local Profiles = {} local function playerAdded(player) local profile = ProfileStore:LoadProfileAsync("Player_"..player.UserId) if profile then profile:AddUserId(player.UserId) profile:Reconcile() profile:ListenToRelease(function() Profiles[profile] = nil player:Kick() end) if not player:IsDecendentOf(Players) then profile:Release() else Profiles[player] = profile print(Profiles[player].Data) end else player.Kick() end end function PlayerDataHandler:Init() for _,player in game.Players:GetPlayers() do task.spawn(playerAdded, player) end game.Players.PlayerAdded:Connect(playerAdded()) game.Players.PlayerRemoving:Connect(function(player) if Profiles[player] then Profiles[player]:Release() end end) end local function getProfile(player) assert(Profiles[player], string.format("Profile doesn't exist for %s", player.UserId)) return Profiles[player] end -- getter/setter methods function PlayerDataHandler:Get(player, key) local profile = getProfile(player) assert(profile.Data[key],string.format("Data doesn't exist for key: %s", key)) return profile.Data[key] end function PlayerDataHandler:Set(player, key, Value) local profile = getProfile(player) assert(profile.Data[key],string.format("Data doesn't exist for key: %s", key)) assert(type(profile.Data[key])==type(Value), string.format("Key %s is of type %s, and can't be set to to %s of type %s",profile.Data[key],type(profile.Data[key]),Value,type(Value))) profile.Data[key] = Value end function PlayerDataHandler:Update(player, key, callback) local profile = getProfile(player) local oldData = self:Get(player, key) local newData = callback(oldData) self:Set(player, key, newData) end return PlayerDataHandler

  • @MaskedFacez

    @MaskedFacez

    Жыл бұрын

    You may have identified the player improperly if it does not recognize it

  • @NoNameStudios327

    @NoNameStudios327

    9 ай бұрын

    check smth about line 48 game.Players.PlayerAdded:Connect(playerAdded) is the correct line

  • @electroncat

    @electroncat

    9 ай бұрын

    @@NoNameStudios327 OMG Thanks, you fixed my code!

  • @missapplecider4506
    @missapplecider4506 Жыл бұрын

    How would I make it so the script checks if the coin is already in the inventory before giving cash? Like if you own a coin in your inventory you won't get cash when you collect it, but if you do not own the coin you will get cash when collecting it

  • @playDotProduct

    @playDotProduct

    Жыл бұрын

    Use table.find (create.roblox.com/docs/reference/engine/libraries/table) to see if the "Coin" string is in PlayerDataHandler:Get(player, "Inventory") and if it is then you won't get the cash!

  • @missapplecider4506

    @missapplecider4506

    Жыл бұрын

    @@playDotProduct thank you so much you're a life saver!!!

  • @ImmortalSpelldagger

    @ImmortalSpelldagger

    Жыл бұрын

    @@playDotProduct dont do it, use dictonary table so it wont get clogged up example: inventory = { ["Coins"] = { ["Amount"] = 586 } } while giving player coins check if player has coins in table using if inventory["Coins"] then end

  • @0tt869

    @0tt869

    11 ай бұрын

    @@ImmortalSpelldagger how would you get the table from another script?

  • @reminderIknows

    @reminderIknows

    11 ай бұрын

    @@0tt869 Make a new script: If the script is server-sided: local player = nil local profileservice = require(game.ServerScriptService.PlayerDataHandler) game.Players.PlayerAdded:Connect(function(player) plr = player end) repeat wait() until player ~= nil local table = profileservice:Get(player, "Inventory") --this is the table ______________________ If the script is client-sided: local player = game.Players.LocalPlayer local profileservice = require(game.ServerScriptService.PlayerDataHandler) local table = profileservice:Get(player, "Inventory") --this is the table

  • @priceyt6839
    @priceyt683910 ай бұрын

    what is a key

  • @Harlisimms16
    @Harlisimms16 Жыл бұрын

    How do you make a display for the currency?

  • @Kysuto

    @Kysuto

    Жыл бұрын

    call the script and the data you want displayed then put it into said textbox

  • @reminderIknows

    @reminderIknows

    11 ай бұрын

    Make a gui with a textlabel and customise then make a localscript within the textlabel Script: local profileservice = require(game.ServerScriptService.PlayerDataHandler) while wait() do script.Parent.Text = profileservice:Get(player, "Cash") end

  • @zMoonlight

    @zMoonlight

    8 ай бұрын

    @@reminderIknows you can use :GetPropertyChangedSignal() instead of wait() for performance

  • @crane2724
    @crane2724Ай бұрын

    Didn’t work for me unfortunately. Not sure where I went wrong either. I’ll try again with a different tutorial ig 😭

  • @Hello-iw7dx
    @Hello-iw7dx10 ай бұрын

    Mines not saving it’s stuck at 300

  • @Harlisimms16
    @Harlisimms16 Жыл бұрын

    how to i add another Currency like gems to it after making and using the script because ive added it and it says its not part of the profile

  • @playDotProduct

    @playDotProduct

    Жыл бұрын

    You put it in the datatemplate table we make in the beginning

  • @Harlisimms16

    @Harlisimms16

    Жыл бұрын

    @@playDotProduct it still say that Gems isn’t part of the profile

  • @playDotProduct

    @playDotProduct

    Жыл бұрын

    @@Harlisimms16 Send the code for your dataTemplate. Did you call the Reconcile() function on line 23 in PlayerAdded?

  • @Harlisimms16

    @Harlisimms16

    Жыл бұрын

    @@playDotProduct turns out it was in the Gem code it’s self. I put Gem instead of Gems. But after that it all worked thank you.

  • @RangoTheMango

    @RangoTheMango

    Жыл бұрын

    @@playDotProduct i have this issue as well

  • @lightdefender7818
    @lightdefender7818 Жыл бұрын

    Why is your addition to the script so long? You say it's very simple for a large number of DataStores.Thanks anyway, me need to save StrValues...

  • @user-lb6fs2rj7d
    @user-lb6fs2rj7d3 ай бұрын

    I’m sorry but I don’t like to use module script cause’ I can edit it and can get outdated. But I still appreciate that work on making saving data easier.

  • @user-lb6fs2rj7d

    @user-lb6fs2rj7d

    3 ай бұрын

    Also I wanted to be professional

  • @Harlisimms16
    @Harlisimms16 Жыл бұрын

    im getting this error - ServerScriptService.PlayerDataHandler:69: attempt to index nil with 'Data'

  • @playDotProduct

    @playDotProduct

    Жыл бұрын

    Send your line of code for line 69!

  • @Harlisimms16

    @Harlisimms16

    Жыл бұрын

    @@playDotProduct just checked the code and I checked yours and I missed out return profiles[player] on the function getProfile

  • @subscheme

    @subscheme

    Жыл бұрын

    @@Harlisimms16 I missed the exact same thing LOL