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
 

Data persistence

Previous Thread :: Next Thread 
gamert7 is not online. gamert7
Joined: 18 Nov 2008
Total Posts: 4986
22 Apr 2013 06:17 AM
game.Players.PlayerAdded:connect(function(newPlayer)
newPlayer:WaitForDataReady()
local pin = newPlayer:LoadInstance("Pin", newPlayer.Pin)


local function sChange(val)
newPlayer:SaveInstance("Pin", newPlayer.Pin)
end
newPlayer.Pin.Changed:connect(sChange)
end)

--Output: Pin is not a valid member of Player.
Report Abuse
gamert7 is not online. gamert7
Joined: 18 Nov 2008
Total Posts: 4986
22 Apr 2013 06:39 AM
BUMP
Report Abuse
gamert7 is not online. gamert7
Joined: 18 Nov 2008
Total Posts: 4986
22 Apr 2013 06:45 AM
bump.
Report Abuse
Voxility is not online. Voxility
Joined: 15 Apr 2013
Total Posts: 584
22 Apr 2013 06:56 AM
    game:GetService("Players").PlayerAdded:connect(function(Player)
        Player:WaitForDataReady()
        local Key,Error = pcall(function()
            return Player:LoadInstance("Pin",newPlayer.Pin)
        end)
        if Key then
            --> Place what ever you want here
        end
    end)
Report Abuse
gamert7 is not online. gamert7
Joined: 18 Nov 2008
Total Posts: 4986
22 Apr 2013 07:25 AM
That just left me with the same error as above.
Report Abuse
Voxility is not online. Voxility
Joined: 15 Apr 2013
Total Posts: 584
22 Apr 2013 07:28 AM
Opps, stop trying to parent it in PLayer.Pin
Does Player.Pin exist?
Report Abuse
gamert7 is not online. gamert7
Joined: 18 Nov 2008
Total Posts: 4986
22 Apr 2013 07:29 AM
Yes it does exist.
Report Abuse
gamert7 is not online. gamert7
Joined: 18 Nov 2008
Total Posts: 4986
22 Apr 2013 07:37 AM
I got rid of the error but, now the Instance just doesn't load.
Report Abuse
gamert7 is not online. gamert7
Joined: 18 Nov 2008
Total Posts: 4986
22 Apr 2013 08:32 AM
bump
Report Abuse
gamert7 is not online. gamert7
Joined: 18 Nov 2008
Total Posts: 4986
22 Apr 2013 01:04 PM
bump.
Report Abuse
gamert7 is not online. gamert7
Joined: 18 Nov 2008
Total Posts: 4986
22 Apr 2013 02:03 PM
Bump.
Report Abuse
eugenevorld is not online. eugenevorld
Joined: 15 Nov 2008
Total Posts: 310
22 Apr 2013 07:28 PM
Which line does it say that pin doesn't exist? I know you got rid of the error but that doesn't solve anything as now the instance doesn't load.
Report Abuse
gamert7 is not online. gamert7
Joined: 18 Nov 2008
Total Posts: 4986
22 Apr 2013 07:35 PM
game.Players.PlayerAdded:connect(function(player)
player:WaitForDataReady()
-->player:LoadNumber("Pin")
end)

game.Players.PlayerAdded:connect(function(Player)
if Player.DataReady then
Player:WaitForChild("Pin").Changed:connect(function(val)
Player:SaveNumber("Pin", val)

end)
end
end)
Report Abuse
MrChubbs is not online. MrChubbs
Joined: 14 Oct 2010
Total Posts: 4969
22 Apr 2013 07:39 PM
game.Players.PlayerAdded:connect(function(player)
player:WaitForDataReady()
local a = player:LoadNumber("Pin")
local leaderstats = Instance.new("StringValue", player)
leaderstats.Value = "MrChubbs is a pwnicorn"
local Pin = Instance.new("IntValue", player)
Pin.Name = "Pin"
Pin.Value = a
end)

game.Players.PlayerRemoving:connect(function(Player)
player:WaitForDataReady()
if Player.DataReady then
Player:SaveNumber("Pin", Player.Pin.Value)
end
end)
Report Abuse
gamert7 is not online. gamert7
Joined: 18 Nov 2008
Total Posts: 4986
22 Apr 2013 07:49 PM
Still doesn't save/load. and not output.
Report Abuse
MrChubbs is not online. MrChubbs
Joined: 14 Oct 2010
Total Posts: 4969
22 Apr 2013 07:53 PM
game.Players.PlayerAdded:connect(function(player)
player:WaitForDataReady()
local a = player:LoadNumber("Pin")
local leaderstats = Instance.new("StringValue", player)
leaderstats.Value = "MrChubbs is a pwnicorn"
local Pin = Instance.new("IntValue", player)
Pin.Name = "Pin"
Pin.Value = a
end)
game.Players.PlayerRemoving:connect(function(Player)
Player:WaitForDataReady()
if Player.DataReady then
Player:SaveNumber("Pin", Player.Pin.Value)
end
end)

Try now.
Report Abuse
gamert7 is not online. gamert7
Joined: 18 Nov 2008
Total Posts: 4986
22 Apr 2013 08:08 PM
Nope. No output and it doesn't save/load.
Report Abuse
gamert7 is not online. gamert7
Joined: 18 Nov 2008
Total Posts: 4986
22 Apr 2013 11:13 PM
bump.
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