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 8 years ago
Edited 8 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:

01function PlayerEntered(player)
02local Player = player
03local PlayerGui = Player.PlayerGui:GetChildren()
04for i,v in pairs(PlayerGui) do
05    local DataStoreService = game:GetService("DataStoreService")
06    repeat wait() until player.Character
07    if DataStoreService:GetAsync("StarterGui"..Player.Name) ~= nil then
08        v = DataStoreService:GetAsync("StarterGui"..Player.Name)
09    else
10        v = game.StarterGui:GetChildren()
11    end
12    v.Changed:connect(function(Val)
13        DataStoreService:SetAsync("StarterGui"..player.Name, Val)
14    end)
15    end
16end
17game.Players.PlayerAdded:connect(PlayerEntered)
0
why do you need to save the gui? User#5423 17 — 8y
0
I said It was a Pokemon and the Pokemon are in the Gui narrowricky -14 — 8y
2
You would save the information about the pokemon not the gui User#5423 17 — 8y
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 — 8y

Answer this question