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: Saving Player's backpack help

Previous Thread :: Next Thread 
jlpt is not online. jlpt
Joined: 16 May 2016
Total Posts: 63
24 May 2017 04:31 PM
I made it so that i saves the player's backpack but if you have a tool equipped and leave then that tool wouldn't save because it would be in the backpack i tried making it so that when you leave it adds # #### tool in your hand but it says it can't find Character any help? tools = game:GetService("DataStoreService"):GetDataStore("Tools") game.Players.PlayerAdded:connect(function(pj) local ptools = tools:GetAsync(tostring(pj.userId)) if ptools then for i, v in pairs(ptools) do game.ReplicatedStorage[v]:Clone().Parent = pj.Backpack end end end) game.Players.PlayerRemoving:connect(function(pr) pr.Character.Humanoid:EquipTool(game.ReplicatedStorage["Null Tool"]) local ptools = {} for i, v in pairs(pr.Backpack:GetChildren()) do table.insert(ptools, v.Name) end tools:SetAsync(tostring(pr.userId), ptools) end)
Report Abuse
Goulstem is not online. Goulstem
Joined: 04 Jul 2012
Total Posts: 7177
24 May 2017 04:32 PM
you've contracted the hash virus.

#previewb4posting


Report Abuse
jlpt is not online. jlpt
Joined: 16 May 2016
Total Posts: 63
24 May 2017 04:33 PM
I made it so that i saves the player's backpack but if you have a tool equipped and leave then that tool wouldn't save because it would be in the backpack i tried making it so that when you leave it adds a junk tool in your hand but it says it can't find Character any help?



tools = game:GetService("DataStoreService"):GetDataStore("Tools")

game.Players.PlayerAdded:connect(function(pj)
local ptools = tools:GetAsync(tostring(pj.userId))
if ptools then
for i, v in pairs(ptools) do
game.ReplicatedStorage[v]:Clone().Parent = pj.Backpack

end
end
end)

game.Players.PlayerRemoving:connect(function(pr)

pr.Character.Humanoid:EquipTool(game.ReplicatedStorage["Null Tool"])
local ptools = {}
for i, v in pairs(pr.Backpack:GetChildren()) do
table.insert(ptools, v.Name)
end
tools:SetAsync(tostring(pr.userId), ptools)
end)
Report Abuse
iiNemo is online. iiNemo
Joined: 22 Jul 2013
Total Posts: 2380
24 May 2017 04:41 PM
add this to the top,
repeat wait() until game.Workspace:findFirstChild(game.Players.LocalPlayer.Name) ~= nil
Report Abuse
jlpt is not online. jlpt
Joined: 16 May 2016
Total Posts: 63
24 May 2017 05:25 PM
btw it's a regular script not a local script and that didn't work
Report Abuse
jlpt is not online. jlpt
Joined: 16 May 2016
Total Posts: 63
24 May 2017 05:26 PM
i just need to make it so that it also saves the item your holding since when your holding an item it doesn't show it in the backpack
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