|
| 18 Jun 2014 05:38 PM |
so I made a cash GUI where it is a value in the player but not on leaderboard, how would I use datastore for it?
ty |
|
|
| Report Abuse |
|
|
ThaneDev
|
  |
| Joined: 08 Apr 2009 |
| Total Posts: 1600 |
|
|
| 18 Jun 2014 05:51 PM |
| http://wiki.roblox.com/index.php?title=Data_store |
|
|
| Report Abuse |
|
|
|
| 18 Jun 2014 05:52 PM |
| Instead of trying to find it as player.leaderstats.Something, it would be player.Something |
|
|
| Report Abuse |
|
|
|
| 18 Jun 2014 05:58 PM |
--saving game.Players.PlayerRemoving:connect(function(player) local datastore = game:GetService("DataStoreService"):GetDataStore(player.Name.."Stats")
local statstorage = player:FindFirstChild("Cash"):GetChildren() for i = 1, #statstorage do datastore:SetAsync(statstorage[i].Name, statstorage[i].Value) print("saved data number "..i) end print("Stats successfully saved") end)
--loading game.Players.PlayerAdded:connect(function(player) local datastore = game:GetService("DataStoreService"):GetDataStore(player.Name.."Stats") player:WaitForChild("Cash") wait(1) local stats = player:FindFirstChild("Cash"):GetChildren() for i = 1, #stats do stats[i].Value = datastore:GetAsync(stats[i].Name) print("stat numba "..i.." has been found") end end)
What is player.Name.."Stats") |
|
|
| Report Abuse |
|
|
| |
|