iiNemo
|
  |
| Joined: 22 Jul 2013 |
| Total Posts: 2380 |
|
|
| 21 Jun 2017 04:29 PM |
| I'm not the greatest at DataStore, but how would I get the children of a folder and save there names the DataStore? Then how would I find the childrens of a folder that names match the DataStores saves names, then clone it in to another folder? |
|
|
| Report Abuse |
|
|
|
| 21 Jun 2017 04:31 PM |
Wiki has a great article about datastores
-- roblox chat syst## |
|
|
| Report Abuse |
|
|
iiNemo
|
  |
| Joined: 22 Jul 2013 |
| Total Posts: 2380 |
|
|
| 21 Jun 2017 05:25 PM |
game.Players.PlayerRemoving:Connect(function(Player) local DataStore = game:GetService('DataStoreService'):GetDataStore(Prefix..Player.UserId..'Objects'..Suffix) local Tools = DataStore:GetAsync('Tools') if game.ReplicatedStorage.Bag:FindFirstChild(Player.Name) ~= nil then for i, v in pairs (game.ReplicatedStorage.Bag[Player.Name]:GetChildren()) do Tools:SetAsync(i, v.Name) -- Error Here: attempt to index local 'Tools' (a nil value) end end end)
Why an error?
|
|
|
| Report Abuse |
|
|
iiNemo
|
  |
| Joined: 22 Jul 2013 |
| Total Posts: 2380 |
|
|
| 21 Jun 2017 05:44 PM |
| Please help, I know some of ya know this.. |
|
|
| Report Abuse |
|
|
Cryxez
|
  |
| Joined: 20 Jul 2011 |
| Total Posts: 1381 |
|
|
| 21 Jun 2017 06:30 PM |
| Error because you can't setasync on getasync |
|
|
| Report Abuse |
|
|
iiNemo
|
  |
| Joined: 22 Jul 2013 |
| Total Posts: 2380 |
|
|
| 21 Jun 2017 07:51 PM |
This is how I save it for i, v in pairs (game.ReplicatedStorage.Bag[Player.Name]:GetChildren()) do print(v.Name) DataStore:SetAsync('Tools', v.Name) end This how I load it for i = 1, #Tools do if Tools[i] == '' then i = i - 1 else print(Tools[i]) game.ReplicatedStorage.AllTools[Tools[i]]:Clone().Parent = game.ReplicatedStorage.Bag[Player.Name] end end print[Tools[I] == nil, why? When I print v.Name it == 'Rusty Sword' |
|
|
| Report Abuse |
|
|
iiNemo
|
  |
| Joined: 22 Jul 2013 |
| Total Posts: 2380 |
|
| |
|
Cryxez
|
  |
| Joined: 20 Jul 2011 |
| Total Posts: 1381 |
|
|
| 22 Jun 2017 03:16 AM |
1) You try to print it with uppercase "I", when the loop is lowercase "i" 2) you try to print it outside the scope of the for loop |
|
|
| Report Abuse |
|
|
|
| 22 Jun 2017 03:57 AM |
| I think the closest datastore equivalent ur gonna get to a folder (Because you cant save the folder itself to a datastore) is lists. They both have the same concept although one is used for physical stuff and the other text-based data |
|
|
| Report Abuse |
|
|
iiNemo
|
  |
| Joined: 22 Jul 2013 |
| Total Posts: 2380 |
|
|
| 22 Jun 2017 09:24 AM |
| Arkham, I'm getting the childrens names and saving it In to the data store. Also whenever I type in I for some reason, it gets capitalized except not in the script.. |
|
|
| Report Abuse |
|
|
iiNemo
|
  |
| Joined: 22 Jul 2013 |
| Total Posts: 2380 |
|
|
| 22 Jun 2017 09:24 AM |
| In other words, how would I get the children of a model then save it to a datastore? |
|
|
| Report Abuse |
|
|
iiNemo
|
  |
| Joined: 22 Jul 2013 |
| Total Posts: 2380 |
|
| |
|
iiNemo
|
  |
| Joined: 22 Jul 2013 |
| Total Posts: 2380 |
|
|
| 22 Jun 2017 09:51 AM |
| I got it, I put Tools into a table and got it from there.. |
|
|
| Report Abuse |
|
|