How do I go about datastoring a TextButton

Hi, I’m trying to create an inventory system that uses a UIgridlayout and adds a template textbutton with 4 number values. I want to save the TextButtons that has the numbervalues inside of it, but I am not quite sure how to do that.

Firstly you would need to understand how datastores work

Once you understand how to load and save data you would want to be saving a table of data. e.g

	["Dir"] = {
		["Button1"] = {
			["1"] = 0,
			["2"] = 0,
			["3"] = 0,
			["4"] = 0,
		}
	}
}

Personally with the datstore set-up i would be using instances with folders and values to make it easier to visualise whats happening. (makes it easier to view on studio and see where your codes going wrong as well)

As to the how

you would want a remote to send information to the server of the button with the values you want to be saved, then it’s simply editing your dictionary/instance folder.

let me know if something doesn’t make sense

1 Like

First of all you can’t save objects to datastores, you’d need to make a table with everything that defines your object (in this case a GuiButton) and save that table to the datastore rather than the object itself. This can get sort of confusing so I’d definitely suggest getting more familiar with datastores and tables first.

1 Like