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: why wont my datastore script work

Previous Thread :: Next Thread 
SoapyDishy is not online. SoapyDishy
Joined: 31 Aug 2015
Total Posts: 2169
22 Jun 2016 11:53 AM
dt = game:GetService("DataStoreService"):GetDataStore("BackpackContents")


game.Players.PlayerAdded:connect(function(plr)
identity = "user-"..plr.userId

local storage = dt:GetAsync(identity)

if storage then
for i = 1, #storage do
game:GetService("ReplicatedStorage"):FindFirstChild(storage[i]):clone().Parent = plr.Backpack

end
else
local crap = { }

for i, v in pairs(plr.Backpack:GetChildren()) do
v.Name = crap[i]


end
dt:SetAsync(identity,crap)
end
end)

game.Players.PlayerRemoving:connect(function(plr)
local storage = { }
for i, v in pairs(plr.Backpack:GetChildren()) do
v.Name = storage[i]
end
dt:SetAsync(identity,storage)
end)

its not saving the players backpack
Report Abuse
sammyhiman1 is not online. sammyhiman1
Joined: 27 Nov 2013
Total Posts: 98
22 Jun 2016 11:54 AM
UserId, not userId
Report Abuse
iDerpyDogez is not online. iDerpyDogez
Joined: 05 Feb 2012
Total Posts: 1781
22 Jun 2016 12:10 PM
its userId


#code while true do end
Report Abuse
SoapyDishy is not online. SoapyDishy
Joined: 31 Aug 2015
Total Posts: 2169
22 Jun 2016 02:23 PM
...
Report Abuse
TimeTicks is not online. TimeTicks
Joined: 27 Apr 2011
Total Posts: 27115
22 Jun 2016 02:24 PM
UserId *

Remember to updte your ds when you modify it. Like

"BackpackContents0.02"


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