|
| 07 Feb 2016 07:26 AM |
I have tried data store, data persistence, using JSON, and simply looking in free models yet can't seem to find a way to make the value save. Help?
RockerCaleb1234 ;P |
|
|
| Report Abuse |
|
xlaser23
|
  |
| Joined: 10 Dec 2011 |
| Total Posts: 20341 |
|
|
| 07 Feb 2016 07:28 AM |
my example datastores use it
local DataStore = game:GetService("DataStoreService"):GetDataStore("LaserStore")
game.Players.PlayerAdded:connect(function(player) local stats = Instance.new("IntValue", player) stats.Name = "leaderstats" local points = Instance.new("IntValue", stats) points.Name = "Points" local coins = Instance.new("IntValue", stats) coins.Name = "Coins" local key = "player-"..player.userId local savedValues = DataStore:GetAsync(key) if savedValues then --Save format: {points, coins} points.Value = savedValues[1] coins.Value = savedValues[2] else local valuesToSave = {points.Value, coins.Value} DataStore:SetAsync(key, valuesToSave) end end)
--[[ local DataStore = game:GetService("DataStoreService")<---This Part Gets the Service "DataStore:GetDataStore("Anyname")<---This is the Datastore u get the data from
game.Players.PlayerAdded:connect(function(player)<---Player Added local stats = Instance.new("IntValue", player) stats.Name = "leaderstats" local points = Instance.new("IntValue", stats) points.Name = "Points" local coins = Instance.new("IntValue", stats) coins.Name = "Coins"-- Making Leader Board stats <----Things gonna get Real----> i will do this (-1-) to show the Order in the teaching local key = "player-"..player.userId(-2-)The key is the code for the Saved Data Every Player needs a special code so use player.userId because every player has there own userID local savedValues = DataStore:GetAsync(key)(-1-)This Getting the Data from the Key if savedValues then(-3-)Checking if people have the data if it does then --Save format: {points, coins}<--Table Showing how the saving is gonna work out points.Value = savedValues[1]<--This numbers show the Order in which the table is going to save/load in coins.Value = savedValues[2] else local valuesToSave = {points.Value, coins.Value}<---Saves Points DataStore:SetAsync(key, valuesToSave)<---Setting the data in the datastores end --]]
http://www.roblox.com/xla-item?id=290739801http://www.roblox.com/aser-item?id=290739819http://www.roblox.com/23-item?id=290739831 R$131 Tx559 (づ ゚ ³ ゚)づ |
|
|
| Report Abuse |
|
|
| 07 Feb 2016 08:15 AM |
Still doesn't work
RockerCaleb1234 ;P |
|
|
| Report Abuse |
|
xlaser23
|
  |
| Joined: 10 Dec 2011 |
| Total Posts: 20341 |
|
|
| 07 Feb 2016 08:18 AM |
this works perfectly fine
ur doing something wrong
http://www.roblox.com/xla-item?id=290739801http://www.roblox.com/aser-item?id=290739819http://www.roblox.com/23-item?id=290739831 R$131 Tx559 (づ ゚ ³ ゚)づ |
|
|
| Report Abuse |
|