of     1   

gunter5
#227684953Saturday, November 18, 2017 9:47 PM GMT

This datastore is fully functional as far as i can tell. I've looked over the code a few times and either my eyes are just sick of looking at it. or i just don't know what the error is. either way. the save function isnt saving the new values i put in to be saved ---- SERVER local DataStore = game:GetService("DataStoreService") local ds = DataStore:GetDataStore("ey3eyekjgyyeyeye") local DataHandler = require(game:GetService("ServerStorage"):WaitForChild("Modules"):WaitForChild("PlayerDataManager")) game:GetService("Players").PlayerAdded:connect(function(player) --Create Data PlaceHolders local lead = Instance.new("Folder", player) lead.Name = "leaderstats" local test = Instance.new("IntValue", lead) test.Name = "test" --Retrieve Data DataHandler.GetData(player, ds, test) print("Data Retrieved") --Autosave Data while wait(--[[60 * 5]] 20) do print("Autosaving...") DataHandler.SaveData(player, ds) print("Autosave Sucessful!") end end) --Save Data on Player Left game:GetService("Players").PlayerRemoving:connect(function(player) DataHandler.SaveData(player, ds) end) ---- MODULE local DataHandler = {} local Stats = {} local DefaultStats = {50} function DataHandler.GetData(player, ds, test) pcall(function() Stats = ds:GetAsync(player.UserId) end) if Stats then -- Check to see if they have played the game and have a entry in data store. --load stats test.Value = Stats[1] print("Loading Data...") else -- If they dont have data created then create data. Stats = DefaultStats print("Creating New Data...") end end function DataHandler.SaveData(player, ds) ds:SetAsync(player.UserId, Stats) print("Saving Data...") end return DataHandler
BlueFluffyNinja
#227685035Saturday, November 18, 2017 9:49 PM GMT

Don't Module Scripts, its just making it harder for yourself.
gunter5
#227922592Friday, November 24, 2017 7:33 AM GMT

Maybe, but it's also valuable practice so i can get better with modular scripting. (bump still need some assistance)
amanda
#227923948Friday, November 24, 2017 8:35 AM GMT

add prints every time you are doing something with the value setting it, retrieving it, etc find out at which point the value is being dropped

    of     1