Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How would you write a script that would save a Gui when you leave?

Asked by 7 years ago
Edited 7 years ago

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)
0
why do you need to save the gui? User#5423 17 — 7y
0
I said It was a Pokemon and the Pokemon are in the Gui narrowricky -14 — 7y
2
You would save the information about the pokemon not the gui User#5423 17 — 7y
0
But the Pokemon are in a folder and when you catch one it goes into another folder where your Pokemon are stored narrowricky -14 — 7y

Answer this question