C1OSE
|
  |
| Joined: 29 May 2011 |
| Total Posts: 604 |
|
|
| 18 Dec 2016 03:10 PM |
I need to fix my save script, people are complaining about data loss and idk how to solve it, i also want to change the save script so it says every 10 seconds rather than when the player leaves.
game.Players.PlayerRemoving:connect(function(p) if p:findFirstChild("leaderstats") then p:SaveInstance("SavedStatPNum"..tostring(game.PlaceId),p.leaderstats) end end) game.Players.PlayerAdded:connect(function(p) for k = 1, 60, 0.03 do wait() if p:findFirstChild("leaderstats") and p.DataReady then break end end local Loaded = nil if p:findFirstChild("leaderstats") and pcall(function() Loaded = p:LoadInstance("SavedStatPNum"..tostring(game.PlaceId)) end) then for j, v in pairs(Loaded:GetChildren()) do pcall(function() p.leaderstats[v.Name].Value = v.Value end) end end end)
|
|
|
| Report Abuse |
|
|
|
| 18 Dec 2016 03:11 PM |
| This is deprecated, use Datastores. |
|
|
| Report Abuse |
|
|
| |
|
C1OSE
|
  |
| Joined: 29 May 2011 |
| Total Posts: 604 |
|
|
| 18 Dec 2016 03:17 PM |
@10 lol
@guy above 10
idk how id do that, i read the wiki and datastores confuse me o.o
|
|
|
| Report Abuse |
|
|
|
| 18 Dec 2016 03:23 PM |
@C1OSE
Look up PeasPod tutorial on YouTube, it's very detailed and it explains how to create one. |
|
|
| Report Abuse |
|
|
|
| 18 Dec 2016 03:24 PM |
| Use DataStores, look at tutorials, its much easier to use |
|
|
| Report Abuse |
|
|
C1OSE
|
  |
| Joined: 29 May 2011 |
| Total Posts: 604 |
|
|
| 19 Dec 2016 01:56 PM |
im god awful at following tutorials, im more of a learner where im sharing screens on skype and someone shows me how to do it and teaches me that way, can no one do that or convert my script into a datastore? im really struggling here and i gotta get this done because im getting so many complaints on my game and theres so many ppl that are mad lol
|
|
|
| Report Abuse |
|
|
C1OSE
|
  |
| Joined: 29 May 2011 |
| Total Posts: 604 |
|
| |
|
C1OSE
|
  |
| Joined: 29 May 2011 |
| Total Posts: 604 |
|
| |
|
TimeTicks
|
  |
| Joined: 27 Apr 2011 |
| Total Posts: 27115 |
|
|
| 19 Dec 2016 09:44 PM |
Use datastores and if its a model, save the name of the model and then load it back in.
data persistence doesn't work anymore.
|
|
|
| Report Abuse |
|
|
| |
|
vexieh
|
  |
| Joined: 22 Oct 2009 |
| Total Posts: 3468 |
|
|
| 19 Dec 2016 09:46 PM |
| copy and paste code from google until it works 10/10 |
|
|
| Report Abuse |
|
|
|
| 19 Dec 2016 09:47 PM |
try using this https://forum.roblox.com/Forum/ShowPost.aspx?PostID=201595803
attempt to call girlfriend (a nil value) | (͠≖ ͜ʖ͠≖)👌 | nothin' like a good argument ¯\_(ツ)_/¯ |
|
|
| Report Abuse |
|
|
C1OSE
|
  |
| Joined: 29 May 2011 |
| Total Posts: 604 |
|
|
| 25 Dec 2016 11:12 AM |
@half eeeeeeeeeeeeeeeeeeeeh
|
|
|
| Report Abuse |
|
|
|
| 25 Dec 2016 11:14 AM |
| You're going to have to teach datastores to yourself, I don't think anyone here is willing to skype you to help you figure it out :( |
|
|
| Report Abuse |
|
|
alij12
|
  |
| Joined: 03 Oct 2011 |
| Total Posts: 1204 |
|
|
| 25 Dec 2016 11:23 AM |
| Im feeling nice. btw you cant save Instances w/ datastores directly, so Im gonna change this up. local ds = ############################################################# game.Players.PlayerRemoving:connect(function(p) if p:findFirstChild("leaderstats") then for i,v in pairs(p.leaderstats:GetChildren()) do ds:SetAsync(p.Name.."_"..v.Name,v.Value) --Assuming everything in here has a value that isnt an object/instance end end end) game.Players.PlayerAdded:connect(function(p) repeat wait() until p:findFirstChild("leaderstats") for i,v in pairs(p.leaderstats:GetChildren()) do if ds:GetAsync(p.Name.."_"..v.Name) ~= nil then v.Value = ds:GetAsync(p.Name.."_"..v.Name) else print(p.Name.." has no data for "..v.Name.."!") end end end) |
|
|
| Report Abuse |
|
|
alij12
|
  |
| Joined: 03 Oct 2011 |
| Total Posts: 1204 |
|
|
| 25 Dec 2016 11:25 AM |
ugh
htt ps://hasteb in.co m/gaguyed aco.l ua
|
|
|
| Report Abuse |
|
|
C1OSE
|
  |
| Joined: 29 May 2011 |
| Total Posts: 604 |
|
|
| 25 Dec 2016 06:40 PM |
@al
why did u remove it? D:
|
|
|
| Report Abuse |
|
|
alij12
|
  |
| Joined: 03 Oct 2011 |
| Total Posts: 1204 |
|
|
| 25 Dec 2016 06:46 PM |
Remove what?
Do not give up; the beginning is always the hardest part. |
|
|
| Report Abuse |
|
|
C1OSE
|
  |
| Joined: 29 May 2011 |
| Total Posts: 604 |
|
| |
|
alij12
|
  |
| Joined: 03 Oct 2011 |
| Total Posts: 1204 |
|
|
| 26 Dec 2016 12:09 PM |
its still there for me
Do not give up; the beginning is always the hardest part. |
|
|
| Report Abuse |
|
|
Soybeen
|
  |
| Joined: 17 Feb 2010 |
| Total Posts: 21462 |
|
|
| 26 Dec 2016 03:49 PM |
| local ds = ############################################################## -- saving the data, will "leaderstats" still be around? game.Players.PlayerRemoving:connect(function(player) if player:FindFirstChild("leaderstats") then local data = {} for _,v in next,leaderstats:GetChildren() do -- make sure only values are in this data[v.Name] = v.Value end ds:SetAsync(player.UserId,data) end end) -- loading the data game.Players.PlayerAdded:connect(function(player) local data = ds:GetAsync(player.UserId) local stats = Instance.new("Model",player) stats.Name = "leaderstats" ############# = { {"Money","IntValue"}, {"XP","IntValue"}, {"Level","IntValue"}, {"Title","StringValue"} } for _,stat in ################## do local newStat = Instance.new(stat[2],leaderstats) newStat.Value = data[stat[1]] end end) |
|
|
| Report Abuse |
|
|
Soybeen
|
  |
| Joined: 17 Feb 2010 |
| Total Posts: 21462 |
|
|
| 26 Dec 2016 03:50 PM |
paste bin. com/ JLTbZ1NC
I always forget that Roblox gets triggered when you talk about datastores.
|
|
|
| Report Abuse |
|
|
C1OSE
|
  |
| Joined: 29 May 2011 |
| Total Posts: 604 |
|
|
| 27 Dec 2016 06:04 PM |
| @soy and i can just paste this into a regular script and its good to go in the workspace? or? |
|
|
| Report Abuse |
|
|
C1OSE
|
  |
| Joined: 29 May 2011 |
| Total Posts: 604 |
|
|
| 27 Dec 2016 06:12 PM |
@soy
this error came up
19:12:09.743 - Workspace.Stats Save:27: attempt to index local 'data' (a nil value) 19:12:09.744 - Stack Begin 19:12:09.745 - Script 'Workspace.Stats Save', Line 27 19:12:09.745 - Stack End |
|
|
| Report Abuse |
|
|