Eventive
|
  |
| Joined: 28 Jul 2011 |
| Total Posts: 9827 |
|
|
| 07 May 2017 01:39 PM |
local ValueType if typeof(v)=="boolean" then ValueType="BoolValue" elseif typeof(v)=="number" then ValueType="NumberValue" end local s=Instance.new(ValueType) ---- error refers to this s.Name=v s.Value=i s.Parent=inven
14:37:47.625 - ServerScriptService.InventorySave:15: bad argument #1 to 'new' (string expected, got nil)
ATR'er since 2013. |
|
|
| Report Abuse |
|
|
chimmihc
|
  |
| Joined: 01 Sep 2014 |
| Total Posts: 17143 |
|
|
| 07 May 2017 01:41 PM |
None of the if branches are being reached.
|
|
|
| Report Abuse |
|
|
Intern33t
|
  |
| Joined: 19 Nov 2010 |
| Total Posts: 1530 |
|
|
| 07 May 2017 01:42 PM |
um
local s = Instance.new("ValueType")
hm
|
|
|
| Report Abuse |
|
|
Eventive
|
  |
| Joined: 28 Jul 2011 |
| Total Posts: 9827 |
|
|
| 07 May 2017 01:42 PM |
What do you mean?
ATR'er since 2013. |
|
|
| Report Abuse |
|
|
Intern33t
|
  |
| Joined: 19 Nov 2010 |
| Total Posts: 1530 |
|
|
| 07 May 2017 01:42 PM |
wait ignore last
im an idiot
|
|
|
| Report Abuse |
|
|
Eventive
|
  |
| Joined: 28 Jul 2011 |
| Total Posts: 9827 |
|
| |
|
|
| 07 May 2017 01:51 PM |
| There's no such thing as "ValueType". |
|
|
| Report Abuse |
|
|
Eventive
|
  |
| Joined: 28 Jul 2011 |
| Total Posts: 9827 |
|
|
| 07 May 2017 02:01 PM |
@text "local ValueType if typeof(v)=="boolean" then ValueType="BoolValue" elseif typeof(v)=="number" then ValueType="NumberValue" end"
ATR'er since 2013. |
|
|
| Report Abuse |
|
|
chimmihc
|
  |
| Joined: 01 Sep 2014 |
| Total Posts: 17143 |
|
|
| 07 May 2017 02:04 PM |
local ValueType if typeof(v)=="boolean" then ValueType="BoolValue" elseif typeof(v)=="number" then ValueType="NumberValue" end
Neither the "ValueType="BoolValue"" part or the "ValueType="NumberValue"" part are being reached.
ValueType is nil.
|
|
|
| Report Abuse |
|
|
Eventive
|
  |
| Joined: 28 Jul 2011 |
| Total Posts: 9827 |
|
|
| 07 May 2017 02:06 PM |
so how would I fix that?
ATR'er since 2013. |
|
|
| Report Abuse |
|
|
Eventive
|
  |
| Joined: 28 Jul 2011 |
| Total Posts: 9827 |
|
| |
|
|
| 07 May 2017 02:49 PM |
Check if it isn't nil...
local ValueType if typeof(v)=="boolean" then ValueType="BoolValue" elseif typeof(v)=="number" then ValueType="NumberValue" end if ValueType then local s=Instance.new(ValueType) ---- error refers to this s.Name=v s.Value=i s.Parent=inven end |
|
|
| Report Abuse |
|
|
Eventive
|
  |
| Joined: 28 Jul 2011 |
| Total Posts: 9827 |
|
|
| 07 May 2017 02:52 PM |
Now its not loading anything in
ATR'er since 2013. |
|
|
| Report Abuse |
|
|
Eventive
|
  |
| Joined: 28 Jul 2011 |
| Total Posts: 9827 |
|
|
| 07 May 2017 02:53 PM |
full script:
local ds = game:GetService('DataStoreService'):GetDataStore('MoreItems') local newtab = {}
game.Players.PlayerAdded:connect(function(player) local pds = ds:GetAsync(player.UserId) local inven = player:WaitForChild("Inventory") for i,v in pairs(pds) do local ValueType if typeof(v)=="boolean" then ValueType="BoolValue" elseif typeof(v)=="number" then ValueType="NumberValue" end if ValueType then local s=Instance.new(ValueType) s.Name=v s.Value=i s.Parent=inven end end while player.Parent do for i,v in pairs(inven:GetChildren()) do if inven:FindFirstChild(v.Name) then v.Value=inven[v.Name].Value end end wait(1) end end)
game.Players.PlayerRemoving:connect(function(player) local inven = player:WaitForChild("Inventory") for i,v in pairs(inven:GetChildren()) do table.insert(newtab, v.Name) end ds:SetAsync(player.UserId, newtab) end) game:BindToClose(function() for _,player in pairs(game.Players:GetPlayers()) do local inven = player:WaitForChild("Inventory") for i,v in pairs(inven:GetChildren()) do table.insert(newtab, v.Name) end ds:SetAsync(player.UserId, newtab) end end)
ATR'er since 2013. |
|
|
| Report Abuse |
|
|
Eventive
|
  |
| Joined: 28 Jul 2011 |
| Total Posts: 9827 |
|
| |
|
Eventive
|
  |
| Joined: 28 Jul 2011 |
| Total Posts: 9827 |
|
| |
|
Eventive
|
  |
| Joined: 28 Jul 2011 |
| Total Posts: 9827 |
|
| |
|
Eventive
|
  |
| Joined: 28 Jul 2011 |
| Total Posts: 9827 |
|
| |
|
|
| 08 May 2017 08:33 AM |
Try type instead of typeof.
|
|
|
| Report Abuse |
|
|
ChiefDays
|
  |
| Joined: 26 Sep 2016 |
| Total Posts: 502 |
|
|
| 08 May 2017 08:44 AM |
local ValueType if typeof(v)=="boolean" then ValueType="BoolValue" elseif typeof(v)=="number" then ValueType="NumberValue" end if ValueType then local s=Instance.new(ValueType) ---- error refers to this s.Name=v s.Value=i s.Parent=inven else warn("ValueType is nil because the index is a: "..typeof(v)) end
|
|
|
| Report Abuse |
|
|
Eventive
|
  |
| Joined: 28 Jul 2011 |
| Total Posts: 9827 |
|
|
| 08 May 2017 11:58 AM |
still not working
ATR'er since 2013. |
|
|
| Report Abuse |
|
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
|
| 08 May 2017 12:02 PM |
| If nothing is loading in then it is working properly. You had that error before because the type was neither a number nor a boolean and it still is neither a number nor a boolean. |
|
|
| Report Abuse |
|
|
Eventive
|
  |
| Joined: 28 Jul 2011 |
| Total Posts: 9827 |
|
|
| 08 May 2017 12:02 PM |
Its suppose to load in BoolValues and NumberValues only.
ATR'er since 2013. |
|
|
| Report Abuse |
|
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
| |
|
Eventive
|
  |
| Joined: 28 Jul 2011 |
| Total Posts: 9827 |
|
|
| 08 May 2017 12:05 PM |
That's all that they can put into the folder though. I tested it, I put a BoolValue into the folder, and rejoined, it didn't load in the BoolValue.
The error is gone.
ATR'er since 2013. |
|
|
| Report Abuse |
|
|