Need Help with GUI Saving

Hi there! I am ranger and I just wanted to ask… How do you save a player’s stats for GUIs.

for example such as piggy’s new update where you have to collect papers and it will unlock a page. then after you leave and then rejoin again the page does not reset it just stays there because you have collected all the pages. So similarly how can I do that aswell. Please help me it would be very much appreciated, thanks



1 Like

You could simply use DataStores, which keeps track of all of the every players’ individual data

DataStores have a couple of interesting functions to call for, but you’d mainly use these ones:

  • SetAsync can be used to save the Player’s Data, provided a given unique key (Or the individual data of the Player) & the type of data you want to save

  • GetAsync can be used to load the Player’s Data, provided a given unique key

When calling these functions however, you should encase them in a pcall() to prevent the script from erroring & debugging purposes


Wow, that explanation is great, excuse me, can I ask you a question? In the same way that a value is saved, can it also be used to save anything? Parts, game-objects, etc. ?

Where did you come from LOL

Pretty much, as long as you use the same key given for the Player’s data you want to save

A more easier approach would be is to use tables, which is capable of saving multiple amounts of data at once :thinking:

local DataToSave = {50, "Spaghetti", 1500}
--SetAsync would require the Player's Unique Key, and the value we want to save
local success, whoops = pcall(function()
    DataStore:SetAsync(Player.UserId, DataToSave)

if success then
    print("Data saved")
1 Like

I’m everywhere hahaha! :joy_cat:
Thanks for the clarification! It is very helpful to me and sorry for meddling hahaha

1 Like