I'm trying to make the script save all of the data for the GUI and when I tested it, it didn't work. I been trying to search for the solutions and I couldn't find it. Could somebody help me?
You can also check out the model that included the script and the GUI. It's better to see the model so you could have a better of understanding to what i'm saying.
http://www.roblox.com/D-item?id=313528352
local function setupPlayerData(player) sessionData[player.PlayerGui.StickerGui.Stickers] = {1 = "imgsrc", 2= "imgsrc, 3="imgsrc, 4="imgsrc", 5 = "imgsrc", 6 = "imgsrc", 7 = "imgsrc", 8 = "imgsrc", 9 = "imgsrc", 10 = "imgsrc"} -- this can hold 10 stickers, up if more. end
This is a module script. I don't know if I do this right. :|
-- Require ModuleScript so we can change player stats local PlayerStatManager = require(game.ServerStorage.PlayerStatManager) -- After player joins we'll periodically give the player money and experience game.Players.PlayerAdded:connect(function(player) while wait(2) do PlayerStatManager:ChangeStat(player, 'Money', 5) PlayerStatManager:ChangeStat(player, 'Experience', 1) end end)
local DataStoreService = game:GetService('DataStoreService') local playerData = DataStoreService:GetDataStore('PlayerData') local function setupPlayerData(player) local data = playerData:GetAsync(player.UserId) if not data then data = {1 = "imgsrc", 2= "imgsrc, 3="imgsrc, 4="imgsrc", 5 = "imgsrc", 6 = "imgsrc", 7 = "imgsrc", 8 = "imgsrc", 9 = "imgsrc", 10 = "imgsrc"} playerData:SetAsync(player.UserId, sessionData[player]) end sessionData[player] = data end game.Players.PlayerRemoving:connect(savePlayerData)