How can I save the GUI using DataStore?

You can write your topic however you want, but you need to answer these questions:

  1. I want the GUI to be saved after re-logging into the game.

  2. The problem is that I don’t understand how to do it right.

  3. I have already tried to save the GUI using Remote Events. I have already tried searching on Developer Forum and Developer Hub.

It’s not clear to me how I can save the GUI using DataStore. Could someone explain how to do this?

1 Like

You should serialise your data and then load it in. For example, if you have a blue text button you could make a table that represents that dataset and then save that. When the player rejoins you could write code that takes the data saved and recreates the text button.

2 Likes

You can use a dictionary/table to store every details of a frame that you want to save for example:

data = {
	button1 = {
		size = UDim2.new(1,0,1,0),
		position = UDim2.new(1,0,1,0),
		visible = true
	},
	button2 = {
		size = UDim2.new(1,0,1,0),
		position = UDim2.new(1,0,1,0),
		visible = false
	}
}

Then if you want to load you would just use if statement to check if a certain data.variable is ~= nil.
Of course you can just create a function to help you lessen your lines and also to be more efficient since all your doing is repeating the same script to load the UI.

3 Likes