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 » Scripting Helpers
Home Search
 

Re: Save tools through datastores in universe?

Previous Thread :: Next Thread 
Stonixx is not online. Stonixx
Joined: 05 Jun 2010
Total Posts: 2781
13 Jul 2014 11:58 AM
I have the leaderstats script, but I'm not too sure how to apply it to tools.
Leaderstatats script:

local ds = game:GetService("DataStoreService"):GetDataStore("stats")
stats={"Lvl","XP","Gold"}
game.Players.PlayerAdded:connect(function(plyr)
local a=Instance.new("NumberValue")
a.Parent=plyr
a.Name="leaderstats"
for i=1,#stats do
local stat=Instance.new("NumberValue")
stat.Parent=a
stat.Value=0
stat.Name=stats[i]
end
local child=plyr.leaderstats:GetChildren()
for i=1, #child do
child[i].Value=ds:GetAsync(plyr.userId..child[i].Name)
end
end)

game.Players.PlayerRemoving:connect(function(plyr)
local child=plyr.leaderstats:GetChildren()
for i=1, #child do
child[i].Value=ds:SetAsync(plyr.userId..child[i].Name,child[i].Value)
end
end)




Someone help me apply this to tools?
Ty.

Report Abuse
JarodOfOrbiter is not online. JarodOfOrbiter
Joined: 17 Feb 2011
Total Posts: 20029
13 Jul 2014 12:09 PM
You can't save instances. Just save numbers so you know which tool it is.
Report Abuse
Stonixx is not online. Stonixx
Joined: 05 Jun 2010
Total Posts: 2781
13 Jul 2014 12:53 PM
Ok, thanks.
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • 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