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_Saving ... Problems

Previous Thread :: Next Thread 
kools is not online. kools
Joined: 11 Jan 2009
Total Posts: 1659
03 Mar 2012 09:11 AM
Yeah so one of my first problems is inserting the value.

I expected it to work becuase I do leaderboards all the time.

But for some reason the IntValue is not being inserted into the new player.

Another problem. Since I can't tell if the Saving will work, becuase the IntValue wasn't inserted so can you check those two.

I'm just a begginer at this.

Here's the script:

game.Players.PlayerAdded:connect(function(newplayer)
local new_score = player:LoadNumber("Job")
local new_stat = Instance.new("IntValue", newplayer)
new_stat.Name = "Job"
new_stat.Value = 1
print("Stat given = 1")
wait(2)
player.Job.Value = new_score
player:WaitForDataReady()
print(new_score)
end)

game.Players.CharacterRemoving:connect(function(player)
player:WaitForDataReady()
player:SaveNumber("Job", player.Job.Value)
end)


So yeah.. is there any problems.

{Young Grasshopper}
Report Abuse
jobro13 is not online. jobro13
Joined: 05 Aug 2009
Total Posts: 2865
03 Mar 2012 09:14 AM
You need to use WaitForDataReady() also for Loading!

So.

game.Players.PlayerAdded:connect(function(newplayer)
player:WaitForDataReady()
local new_score = player:LoadNumber("Job")
local new_stat = Instance.new("IntValue", newplayer)
new_stat.Name = "Job"
new_stat.Value = 1
print("Stat given = 1")
wait(2)
player.Job.Value = new_score
print(new_score)
end)

game.Players.CharacterRemoving:connect(function(player)
player:WaitForDataReady()
player:SaveNumber("Job", player.Job.Value)
end)

Also. Test this on a SERVER. Not on your PC, but online. Because OFFLINE on your PC the DataReady is NEVER true, so it will stall at WaitForDataReady()!
Report Abuse
kools is not online. kools
Joined: 11 Jan 2009
Total Posts: 1659
03 Mar 2012 09:17 AM
I'm guessing Play_Solo is not on a Server. :( Kk. I'll add the :WaitForDataReady() on the load. No other problems. Kk. I'll try it.
Report Abuse
jobro13 is not online. jobro13
Joined: 05 Aug 2009
Total Posts: 2865
03 Mar 2012 09:19 AM
Remember, ON Roblox itself. Its kinda frustrating because you gotta upload it, but if you go to solo, or server, and then go to your Player in game.Players you will NEVER see that the DataReady box is true.

Just a random fact, you kno what :WaitForDataReady() is?

Its actually,
repeat wait() until (place where the player is).DataReady == true

Thats it :P

Report Abuse
kools is not online. kools
Joined: 11 Jan 2009
Total Posts: 1659
03 Mar 2012 09:41 AM
I'm checking but the IntValue isn't being inserted into the Player.
Report Abuse
jobro13 is not online. jobro13
Joined: 05 Aug 2009
Total Posts: 2865
03 Mar 2012 09:47 AM
Yes of course. You are playing on play solo now right? Or on your pc at least?

It stalls at the WaitForDataReady, because on your PC it will NEVER be ready and thus ENDLESSLY wait. Remove that one and THEN check if it works! Also remove the Load() then, i dont think it will work.

Just do like to CHECK if you value is inserted put AFTER the lines of the int value like;

game.Workspace.Message.Text = newplayer.Job.Value

If message is 1 then it works! (This is PRINTING on server!)

Report Abuse
kools is not online. kools
Joined: 11 Jan 2009
Total Posts: 1659
03 Mar 2012 10:01 AM
I'll try it.
Report Abuse
kools is not online. kools
Joined: 11 Jan 2009
Total Posts: 1659
03 Mar 2012 10:11 AM
Didn't Work.

game.Players.PlayerAdded:connect(function(newplayer)
local new_score = player:LoadNumber("Job")
local NewMessage = Instance.new("Message", game.Workspace)
new_stat.Name = "Job"
new_stat.Value = 1
NewMessage.Text = new_stat.Value
print("Stat given = 1")
player:WaitForDataReady()
wait(2)
player.Job.Value = new_score
NewMessage.Text = new_score
print(new_score)
end)

game.Players.CharacterRemoving:connect(function(player)
player:WaitForDataReady()
player:SaveNumber("Job", player.Job.Value + 1)
end)
Report Abuse
jobro13 is not online. jobro13
Joined: 05 Aug 2009
Total Posts: 2865
03 Mar 2012 10:24 AM
game.Players.PlayerAdded:connect(function(newplayer)
player:WaitForDataReady()
local new_score = player:LoadNumber("Job")
local NewMessage = Instance.new("Message", game.Workspace)
new_stat.Name = "Job"
new_stat.Value = 1
NewMessage.Text = new_stat.Value
print("Stat given = 1")
player:WaitForDataReady()
wait(2)
player.Job.Value = new_score
NewMessage.Text = new_score
print(new_score)
end)

game.Players.CharacterRemoving:connect(function(player)
player:WaitForDataReady()
player:SaveNumber("Job", player.Job.Value + 1)
end)


Try again with this.
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