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: question

Previous Thread :: Next Thread 
calebpwns1002 is not online. calebpwns1002
Joined: 29 Mar 2013
Total Posts: 521
18 Jun 2014 05:38 PM
so I made a cash GUI where it is a value in the player but not on leaderboard, how would I use datastore for it?

ty
Report Abuse
ThaneDev is not online. ThaneDev
Joined: 08 Apr 2009
Total Posts: 1600
18 Jun 2014 05:51 PM
http://wiki.roblox.com/index.php?title=Data_store
Report Abuse
SenseiWarrior is online. SenseiWarrior
Joined: 09 Apr 2011
Total Posts: 12140
18 Jun 2014 05:52 PM
Instead of trying to find it as player.leaderstats.Something, it would be player.Something
Report Abuse
calebpwns1002 is not online. calebpwns1002
Joined: 29 Mar 2013
Total Posts: 521
18 Jun 2014 05:58 PM
--saving
game.Players.PlayerRemoving:connect(function(player)
local datastore = game:GetService("DataStoreService"):GetDataStore(player.Name.."Stats")

local statstorage = player:FindFirstChild("Cash"):GetChildren()
for i = 1, #statstorage do
datastore:SetAsync(statstorage[i].Name, statstorage[i].Value)
print("saved data number "..i)

end
print("Stats successfully saved")
end)


--loading
game.Players.PlayerAdded:connect(function(player)
local datastore = game:GetService("DataStoreService"):GetDataStore(player.Name.."Stats")

player:WaitForChild("Cash")
wait(1)
local stats = player:FindFirstChild("Cash"):GetChildren()
for i = 1, #stats do
stats[i].Value = datastore:GetAsync(stats[i].Name)
print("stat numba "..i.." has been found")
end
end)

What is player.Name.."Stats")
Report Abuse
calebpwns1002 is not online. calebpwns1002
Joined: 29 Mar 2013
Total Posts: 521
18 Jun 2014 06:09 PM
b2
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