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: Data stores transfer(fast to solve.)

Previous Thread :: Next Thread 
alequinchi is not online. alequinchi
Joined: 17 Mar 2011
Total Posts: 111
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
alequinchi is not online. alequinchi
Joined: 17 Mar 2011
Total Posts: 111
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 is not online. vlekje513
Joined: 28 Dec 2010
Total Posts: 9057
30 Apr 2014 05:25 PM
I dont get the script.
Report Abuse
alequinchi is not online. alequinchi
Joined: 17 Mar 2011
Total Posts: 111
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
brinkokevin is not online. brinkokevin
Joined: 25 Jul 2012
Total Posts: 1673
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
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