Games272
|
  |
| Joined: 22 Dec 2013 |
| Total Posts: 18 |
|
|
| 27 Jul 2016 02:42 PM |
--The issue is that it prints even though I never SetAsync for the gear in the DataStore. I only want to print what is actually what the player has.
local x = {"GravityCoil","SpeedCoil","BloxyCola","Pizza"} local ds = game:GetService("DataStoreService"):GetDataStore("dataStore")
for i = 1, #x do if ds:GetAsync(player.userId, x[i]) then local v = Instance.new("Model") v.Name = tostring(x[i]) v.Parent = p print(x[i] .. " was added to " .. player.Name .. "'s inventory.") end end |
|
|
| Report Abuse |
|
|
Games272
|
  |
| Joined: 22 Dec 2013 |
| Total Posts: 18 |
|
| |
|
Games272
|
  |
| Joined: 22 Dec 2013 |
| Total Posts: 18 |
|
| |
|
Games272
|
  |
| Joined: 22 Dec 2013 |
| Total Posts: 18 |
|
| |
|
Games272
|
  |
| Joined: 22 Dec 2013 |
| Total Posts: 18 |
|
| |
|
oscree
|
  |
| Joined: 19 Dec 2008 |
| Total Posts: 127 |
|
|
| 27 Jul 2016 11:58 PM |
local x = {"GravityCoil","SpeedCoil","BloxyCola","Pizza"} local ds = game:GetService("DataStoreService"):GetDataStore("dataStore")
for i = 1, #x do if ds:GetAsync(player.userId, x[i]) then local v = Instance.new("Model") v.Name = tostring(x[i]) v.Parent = p print(x[i] .. " was added to " .. player.Name .. "'s inventory.") end end |
|
|
| Report Abuse |
|
|
| |
|
Skellobit
|
  |
| Joined: 13 Apr 2016 |
| Total Posts: 12758 |
|
|
| 28 Jul 2016 12:09 AM |
no it's not, stop judging his commenting habits
Formerly ToxicDominator - add 17,509 posts |
|
|
| Report Abuse |
|
|
oscree
|
  |
| Joined: 19 Dec 2008 |
| Total Posts: 127 |
|
|
| 28 Jul 2016 12:10 AM |
| I don't think you even had time to try it. |
|
|
| Report Abuse |
|
|
|
| 28 Jul 2016 12:13 AM |
| lol, if u don't know how to script then leave. |
|
|
| Report Abuse |
|
|
oscree
|
  |
| Joined: 19 Dec 2008 |
| Total Posts: 127 |
|
|
| 28 Jul 2016 12:14 AM |
| You came on here and criticized my solution without even seeing if it worked. You are the one who cannot script. |
|
|
| Report Abuse |
|
|
|
| 28 Jul 2016 12:17 AM |
cringy troll
his code: local x = {"GravityCoil","SpeedCoil","BloxyCola","Pizza"} local ds = game:GetService("DataStoreService"):GetDataStore("dataStore")
for i = 1, #x do if ds:GetAsync(player.userId, x[i]) then local v = Instance.new("Model") v.Name = tostring(x[i]) v.Parent = p print(x[i] .. " was added to " .. player.Name .. "'s inventory.") end end
your code: local x = {"GravityCoil","SpeedCoil","BloxyCola","Pizza"} local ds = game:GetService("DataStoreService"):GetDataStore("dataStore")
for i = 1, #x do if ds:GetAsync(player.userId, x[i]) then local v = Instance.new("Model") v.Name = tostring(x[i]) v.Parent = p print(x[i] .. " was added to " .. player.Name .. "'s inventory.") end end |
|
|
| Report Abuse |
|
|
TimeTicks
|
  |
| Joined: 27 Apr 2011 |
| Total Posts: 27115 |
|
|
| 28 Jul 2016 12:18 AM |
local InventoryData = {}
local data = {}
data.LoadData = function(player) local UserId = player.UserId local Data = PlayerData:GetAsync(UserId)
if Data then InventoryData = Data else PlayerData:SetAsync(UserId,InventoryData) end for i,v in next, InventoryData do GetDataValues(v) end end
GetDataValues = function(val) local Inventory = player:WaitForChild('Inventory') local Tool = Instance.new('Model',Inventory) Tool.Name = val print(tool.Name..' added to inventory') end
SetDataValues = function(val) if v:IsA('Tool') then table.insert(InventoryData,v.Name) end end
data.SaveData = function(player) local UserId = player.UserId local Inventory = player:WaitForChild('Inventory') for i,v in next, Inventory:GetChildren() do SetDataValues(v) end PlayerData:SetAsync(UserId,StatsData) end
return data
|
|
|
| Report Abuse |
|
|
TimeTicks
|
  |
| Joined: 27 Apr 2011 |
| Total Posts: 27115 |
|
|
| 28 Jul 2016 12:18 AM |
PlayerData:SetAsync(UserId,InventoryData) *
|
|
|
| Report Abuse |
|
|
oscree
|
  |
| Joined: 19 Dec 2008 |
| Total Posts: 127 |
|
|
| 28 Jul 2016 12:20 AM |
| Did you just steal my script? |
|
|
| Report Abuse |
|
|
TimeTicks
|
  |
| Joined: 27 Apr 2011 |
| Total Posts: 27115 |
|
|
| 28 Jul 2016 12:40 AM |
No. This is my datastore handler that I modified to work with his code.
|
|
|
| Report Abuse |
|
|
oscree
|
  |
| Joined: 19 Dec 2008 |
| Total Posts: 127 |
|
| |
|