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

Data Script Not Working?

Asked by
ImfaoXD 158
8 years ago

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)
0
STOP USING MODELS. PASTE YOUR SCRIPT IN A CODE BLOCK. Marios2 360 — 8y
0
I posted the script. I'm sorry, I just want you to have a better of understanding to what I'm saying. I hope you'll understand. ImfaoXD 158 — 8y

Answer this question