generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

Re: Save DataStore

Previous Thread :: Next Thread 
iiNemo is online. 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
ScripterTutorials is not online. ScripterTutorials
Joined: 01 Sep 2013
Total Posts: 284
21 Jun 2017 04:31 PM
Wiki has a great article about datastores


-- roblox chat syst##
Report Abuse
iiNemo is online. 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 is online. 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 is not online. 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 is online. 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 is online. iiNemo
Joined: 22 Jul 2013
Total Posts: 2380
21 Jun 2017 08:18 PM
bump ^
Report Abuse
Cryxez is not online. 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
ArkhamDeluxe is not online. ArkhamDeluxe
Joined: 21 May 2016
Total Posts: 561
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 is online. 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 is online. 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 is online. iiNemo
Joined: 22 Jul 2013
Total Posts: 2380
22 Jun 2017 09:25 AM
Save the names*
Report Abuse
iiNemo is online. 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
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image