I'm wondering if it is possible to save a player's GUI with either DataStore or another method. I have a script that creates new "Text Buttons" into another GUI and I want all the Text Buttons to be saved when the player leaves and re enters the game.
This is all I got so far, I don't know if it would work
I got an error saying "ScreenGui is not a valid member of PlayerGui" even though it is. How can I fix that as well?
local ds = game:GetService("DataStoreService")
local GUI = ds:GetDataStore("SaveInventory")
game.Players.PlayerAdded:Connect(function(player)
local holder = player.PlayerGui:WaitForChild("ScreenGui").Frame.hold
holder = GUI:GetAsync(tostring(player.UserId))
end)
game.Players.PlayerRemoving:Connect(function(player)
local holder = player.PlayerGui.ScreenGui.Frame.hold
GUI:SetAsync(player.UserId, holder)
end)

3 comments
You cannot save Instances, you would have to save the properties of the Text Buttons using these data types: strings, numbers, tables, booleans (true/false)
Alright thank you
Also, the Server cannot read the PlayerGui instances, since these are meant to be client-related, so you will need a remote event as well.