|
| 30 Apr 2014 04:45 PM |
I learned a little bit more about lua and made this script( with some help). The problem is it use's data persistence and not data stores. I need to change it since I need for the weapons to transfer between worlds. Can somebody transfer this to a script to a data stores script?
function saveWeapons(player) local bin = player.StarterGear local stuff = player.Backpack:GetChildren() for i = 1,#stuff do local name = stuff[i].Name if game.StarterPack:findFirstChild(name)==nil and player.StarterGear:findFirstChild(name)==nil then stuff[i]:Clone().Parent = bin end end local char = player.Character:GetChildren() for i = 1,#char do if char[i].className == "Tool" then local name = char[i].Name if game.StarterPack:findFirstChild(name)==nil and player.StarterGear:findFirstChild(name)==nil then char[i]:Clone().Parent = bin end end end end function onRespawned(player) local findBin = game.Lighting:findFirstChild(player.Name) if findBin~=nil then local stuff = findBin:GetChildren() for i = 1,#stuff do stuff[i]:Clone().Parent = player.Backpack end findBin:Remove() end player.Character.Humanoid.Died:connect(function() saveWeapons(player) end) end
function onPlayerEntered(newPlayer) newPlayer.Changed:connect(function (property) if (property == "Character") then onRespawned(newPlayer) end end) while true do if newPlayer.Character~=nil then break end wait() end newPlayer.Character.Humanoid.Died:connect(function() saveWeapons(newPlayer) end) end
game.Players.PlayerAdded:connect(onPlayerEntered) |
|
|
| Report Abuse |
|
|
|
| 30 Apr 2014 04:58 PM |
| Might not reply for a bit so just leave your suggestion Ill get to it as soon as possible |
|
|
| Report Abuse |
|
|
vlekje513
|
  |
| Joined: 28 Dec 2010 |
| Total Posts: 9057 |
|
| |
|
|
| 01 May 2014 02:34 PM |
| IT use data persistence to save weapons so when you leave and come back you have the same stuff |
|
|
| Report Abuse |
|
|
|
| 01 May 2014 02:37 PM |
| bad news that isnt data persistance it just clones wepons to startergear so wepons save when player die |
|
|
| Report Abuse |
|
|