I've recently been making a Pokemon game and I've needed a save script for a Gui. Also, I've ended up with a script like this:
function PlayerEntered(player)
local Player = player
local PlayerGui = Player.PlayerGui:GetChildren()
for i,v in pairs(PlayerGui) do
local DataStoreService = game:GetService("DataStoreService")
repeat wait() until player.Character
if DataStoreService:GetAsync("StarterGui"..Player.Name) ~= nil then
v = DataStoreService:GetAsync("StarterGui"..Player.Name)
else
v = game.StarterGui:GetChildren()
end
v.Changed:connect(function(Val)
DataStoreService:SetAsync("StarterGui"..player.Name, Val)
end)
end
end
game.Players.PlayerAdded:connect(PlayerEntered)

4 comments
why do you need to save the gui?
I said It was a Pokemon and the Pokemon are in the Gui
You would save the information about the pokemon not the gui
But the Pokemon are in a folder and when you catch one it goes into another folder where your Pokemon are stored