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 persistence help

Previous Thread :: Next Thread 
LV1Z is not online. LV1Z
Joined: 23 Jul 2011
Total Posts: 652
04 Oct 2013 08:41 PM
This is my script, it would not save or load:

function enter(pl)
repeat wait() until pl
pl:waitForDataReady()
local stats = Instance.new("IntValue")
stats.Parent = pl
stats.Name = "leaderstats"

local k = Instance.new("IntValue")
k.Parent = stats
k.Name = "Kills"
k.Value = 0

local ks = Instance.new("IntValue")
ks.Parent = stats
ks.Name = "KillStreak"
ks.Value = 0

local lv = Instance.new("IntValue")
lv.Parent = stats
lv.Name = "Level"
if not pcall(function() lv.Value = player:LoadNumber("Level") end) then
lv.Value = 1
end

local xp = Instance.new("IntValue")
xp.Name = "Exp"
if not pcall(function() xp.Value = player:LoadNumber("XP") end) then
xp.Value = 0
end
xp.Parent = stats

end

game.Players.PlayerAdded:connect(enter)

game.Players.PlayerRemoving:connect(function(player)
player:SaveNumber("Level", player.leaderstats.Level.Value)
player:SaveNumber("XP", player.leaderstats.Exp.Value)
end)
Report Abuse
LV1Z is not online. LV1Z
Joined: 23 Jul 2011
Total Posts: 652
04 Oct 2013 08:53 PM
bump
Report Abuse
LV1Z is not online. LV1Z
Joined: 23 Jul 2011
Total Posts: 652
04 Oct 2013 09:05 PM
halp me please ;-;
Report Abuse
turtlepoop77 is not online. turtlepoop77
Joined: 07 Jul 2010
Total Posts: 4537
04 Oct 2013 09:19 PM
Hmm
Report Abuse
LV1Z is not online. LV1Z
Joined: 23 Jul 2011
Total Posts: 652
04 Oct 2013 09:51 PM
bump
Report Abuse
LV1Z is not online. LV1Z
Joined: 23 Jul 2011
Total Posts: 652
04 Oct 2013 10:05 PM
srsly ;-; common
Report Abuse
LV1Z is not online. LV1Z
Joined: 23 Jul 2011
Total Posts: 652
04 Oct 2013 10:28 PM
i cri for 10 hrs strate ;-; y u do dis,

but seriously, how would you save a Number data when the player leaves?
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