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: Load / Save qq

Previous Thread :: Next Thread 
UnBuild is not online. UnBuild
Joined: 22 Mar 2013
Total Posts: 3233
01 Apr 2013 09:05 PM
I made this script to load / save a players data

I spent a long time making it, and I THOUGHT it worked

So I spent some time making a gui to display the players data

For some reason it never loads the data, just makes new data every time, what is wrong?

Game.Players.PlayerAdded:connect(function(Player) --Checks for joining players

function String(Text) --Creates string function

if Player.PlayerData:FindFirstChild(Text) == nil then --Checks if string exist

Instance.new("StringValue",Player.PlayerData).Name = Text --Makes string value

end --Ends checking if string exist

end --Ends string function

function Number(Text) --Creates number function

if Player.PlayerData:FindFirstChild(Text) == nil then --Checks if number value exist

Instance.new("NumberValue",Player.PlayerData).Name = Text --Makes number value

end --Ends checking if string exist

end --Ends number function

function Bool(Text) --Creates bool function

if Player.PlayerData:FindFirstChild(Text) == nil then --Checks if bool value exist

Instance.new("BoolValue",Player.PlayerData).Name = Text --Makes bool value

end --Ends checking if string exist

end --Ends bool function

function CreateMeSomeData()

Number("RoundsWon")

Number("RoundsLost")

Number("Kills")

Number("Deaths")

Number("ServersPlayed")

Number("RoundsPlayed")

String("Title")

Number("Level")

end

Player:WaitForDataReady() --Waits for player to load

if Player:LoadInstance("SavedData") then --Checks if player has a save

Player:LoadInstance("SavedData").Parent = Workspace --Loads save

CreateMeSomeData() --Creates data

else --Or...

Instance.new("Model", Player).Name = "PlayerData" --Creates model called "PlayerData"

CreateMeSomeData() --Creates data

end --Ends checking if player has a save

end) --Ends checking for joining players

Game.Players.PlayerRemoving:connect(function(Player) --Checks for leaving players

Player:WaitForDataReady() --Waits for player to load? Do I need this?

Player:SaveInstance("SavedData", Player.Save) --Saves

end) --Ends checking for leaving players
Report Abuse
UnBuild is not online. UnBuild
Joined: 22 Mar 2013
Total Posts: 3233
01 Apr 2013 09:12 PM
Player:SaveInstance("SavedData", Player.Save) --Saves


I think I was born stupid or something
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