|
| 03 Feb 2015 08:04 PM |
local ds = game:GetService("DataStoreService"):GetDataStore("Level")
game.Players.PlayerAdded:connect(function(plr) local l = Instance.new("IntValue", plr) l.Name = "leaderstats" local lvl = Instance.new("StringValue",l) lvl.Name = "Level" local key = tostring(plr.userId).."_level" local data = ds:GetAsync(key) or 0 workspace.LevelTPer.Touched:wait() lvl.Value = "1-1" ds:SetAsync(key, lvl.Value) end)
game.Players.PlayerRemoving:connect(function(plr) local key = tostring(plr.userId).."_level" local current = plr.leaderstats.Level local data = ds:GetAsync(key) if data then ds:UpdateAsync(key,function(old) return current.Value; end) else ds:SetAsync(key,current.Value) end end)
//:cpmoderator12345:\\ ||:developer:|| |
|
|
| Report Abuse |
|
|
|
| 03 Feb 2015 08:17 PM |
k
"I like to program." - Bosswalrus |
|
|
| Report Abuse |
|
|
|
| 03 Feb 2015 08:24 PM |
| You gave us so much information to work with! |
|
|
| Report Abuse |
|
|
tbnj123
|
  |
| Joined: 29 Oct 2010 |
| Total Posts: 443 |
|
|
| 03 Feb 2015 08:36 PM |
| workspace.LevelTPer.Touched:wait() |
|
|
| Report Abuse |
|
|
DogeKip
|
  |
| Joined: 06 Mar 2011 |
| Total Posts: 6860 |
|
|
| 03 Feb 2015 08:38 PM |
I'm not even going to try to help because the condition we help is if rbx.lua == "wth" and I believe that is false so nope.
Mudkips > All ~ Previously: awesom914 |
|
|
| Report Abuse |
|
|
MM233
|
  |
| Joined: 19 Jun 2008 |
| Total Posts: 925 |
|
|
| 03 Feb 2015 09:04 PM |
| The title WAS clever, none the less. |
|
|
| Report Abuse |
|
|
|
| 03 Feb 2015 10:43 PM |
There is nothing wrong with 'workspace.LevelTPer.Touched:wait()' It does set the value to 1-1, but the Data Store doesn't save
//:cpmoderator12345:\\ ||:developer:|| |
|
|
| Report Abuse |
|
|
|
| 03 Feb 2015 10:55 PM |
After this line 'ds:SetAsync(key, lvl.Value)' put
print(ds:GetAsync(key)) and see if it's saving.
Each time you set it, try printing it afterwards and see if it actually got set properly.
Also, try using this: http://wiki.roblox.com/index.php?title=PlayerDataStore_module
It's great for automatically and efficiently saving data
|
|
|
| Report Abuse |
|
|
|
| 03 Feb 2015 11:00 PM |
damn, now i have to re-write my script AND use a module...
//:cpmoderator12345:\\ ||:developer:|| |
|
|
| Report Abuse |
|
|
parkiet3
|
  |
| Joined: 16 Jul 2011 |
| Total Posts: 832 |
|
|
| 04 Feb 2015 12:40 AM |
game.OnClose() = function() wait(10)
end |
|
|
| Report Abuse |
|
|
|
| 04 Feb 2015 12:43 AM |
oh ok im a idiot wait but isnt setasync supposed to save? |
|
|
| Report Abuse |
|
|