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
|
  |
| Joined: 04 Jul 2012 |
| Total Posts: 7177 |
|
|
| 24 May 2017 04:32 PM |
you've contracted the hash virus.
#previewb4posting
|
|
|
| Report Abuse |
|
|
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
|
  |
| 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
|
  |
| 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
|
  |
| 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 |
|
|