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: Persistence help please!!!!

Previous Thread :: Next Thread 
LCPLgeek is not online. LCPLgeek
Joined: 28 Dec 2009
Total Posts: 2770
11 Oct 2011 04:55 AM
local packer --Used in pcall function to save their data later.

game.Players.PlayerRemoving:connect(function(Player)--Checks to save the data when player's about to leave
Player:WaitForDataReady()--Make sure the data is primed to save before leaving... otherwise bad things happen lol.
Player:SaveInstance("Pack", Player.StarterGear)--And now we save their current gear.
end)--Closes the function.

game.Players.PlayerAdded:connect(function(newPlayer)--When a player loads into the game.
newPlayer:WaitForDataReady()--Make sure the data is primed for loading.
local success = pcall(function() packer = newPlayer:LoadInstance("Pack") end)--Checks to make sure that the player has gear to load.
if not success then--Welcome newbie!
print("Error: This is player's 1st visit, will save pack on player leaving...")--We'll save your data when your finished pwning zombies :3
else--Hello past user, enjoy the game!
print("Player's startergear found... loading now.")--Load that gear that they worked nice n hard for
p = newPlayer:LoadInstance("Pack")--Well, we already saved it, so lets load er up for he/she.
local start = p:GetChildren()--Starterpack inside of a starterpack = script sparta!
start.Parent = player.StarterGear--Now that we have the gear, lets load it into their gear.
p:Remove()--Hopefully get rid of the inserted data, so we don't have issues.
end end)--Then close it all out.

Ok, I'm not sure if there are issues with this, but my boss owns a very famous game, so I don't want to mess up, so just looking at the code, would this work hopefully?

Purpose: When player is finished slaughtering zombies, it saves the gear they earned, and loads it when they come back.
Does it work?: Need a opinion on issues before I even upload it.

If anyone could say if this would work or not, it'd be great.
Thanks!
LCPLgeek
Developer/Manager BTSTI
Report Abuse
LCPLgeek is not online. LCPLgeek
Joined: 28 Dec 2009
Total Posts: 2770
11 Oct 2011 04:56 AM
I want to make sure this works, please help!
Report Abuse
LCPLgeek is not online. LCPLgeek
Joined: 28 Dec 2009
Total Posts: 2770
11 Oct 2011 04:58 AM
Anyone???
Report Abuse
LCPLgeek is not online. LCPLgeek
Joined: 28 Dec 2009
Total Posts: 2770
11 Oct 2011 05:00 AM
Someone, no fixing required, just point out any possible errors that might occur.
Report Abuse
LCPLgeek is not online. LCPLgeek
Joined: 28 Dec 2009
Total Posts: 2770
11 Oct 2011 05:02 AM
All I want is an opinion. Please?
Report Abuse
LCPLgeek is not online. LCPLgeek
Joined: 28 Dec 2009
Total Posts: 2770
11 Oct 2011 05:04 AM
Wow, so silent on this thread -_-
Report Abuse
joshrocks101 is not online. joshrocks101
Joined: 07 Jun 2011
Total Posts: 1712
11 Oct 2011 05:54 AM
Sorry I would help but I havent really worked with persistance that much.So I mostlikely woulden't know.
Report Abuse
LCPLgeek is not online. LCPLgeek
Joined: 28 Dec 2009
Total Posts: 2770
11 Oct 2011 05:12 PM
That's ok, I just want to make sure that it works before I publish to boss.
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