generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

Datastore and saving issues.

Previous Thread :: Next Thread 
gunter5 is not online. gunter5
Joined: 15 Mar 2011
Total Posts: 737
24 Sep 2017 01:26 PM
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
Report Abuse
gunter5 is not online. gunter5
Joined: 15 Mar 2011
Total Posts: 737
12 Nov 2017 10:27 AM
bump
Report Abuse
gunter5 is not online. gunter5
Joined: 15 Mar 2011
Total Posts: 737
12 Nov 2017 11:06 AM
ding ding chicken wing
Report Abuse
AwesomeGuyElijah2 is not online. AwesomeGuyElijah2
Joined: 08 Apr 2016
Total Posts: 34
12 Nov 2017 11:48 AM
Open output. It will tell u which line needs fixing.
Report Abuse
gunter5 is not online. gunter5
Joined: 15 Mar 2011
Total Posts: 737
12 Nov 2017 12:16 PM
No errors in output.
Report Abuse
gunter5 is not online. gunter5
Joined: 15 Mar 2011
Total Posts: 737
16 Nov 2017 11:18 PM
bump again
Report Abuse
gunter5 is not online. gunter5
Joined: 15 Mar 2011
Total Posts: 737
18 Nov 2017 02:19 AM
look at that, still bumping.
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image