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: I tried to use data persistence

Previous Thread :: Next Thread 
jonesj627 is not online. jonesj627
Joined: 06 Oct 2010
Total Posts: 1496
22 Jan 2014 08:26 PM
game.Players.PlayerAdded:connect(function(player)
bl = Instance.new("BoolValue",player)
bl.Name = "HasPlayed"
bl.Value = false
player:WaitForDataReady()
player:SaveBoolean('HasPlayed', true)
a = Instance.new("Message",workspace)
a.Text = "test"
player:WaitForDataReady()
player:LoadBoolean("HasPlayed")
if player.HasPlayed == true then
a.Text = "you've played this game"
elseif player.HasPlayed == false then
a.Text = "This is your first time playing"
end
end)

game.Players.PlayerRemoving:connect(function(player)
player:WaitForDataReady()
player:SaveBoolean('HasPlayed', true)
end)


this code won't work properly at all, could someone help me?
Report Abuse
notsopwnedg is not online. notsopwnedg
Joined: 07 Nov 2010
Total Posts: 4182
22 Jan 2014 08:36 PM
Why even use an object?

Game.Players.PlayerAdded:connect(function(Player)
Player:WaitForDataReady()
local HasPlayed = Player:LoadBoolean("HasPlayed")
Player:SaveBoolean("HasPlayed",true)

A = Instance.new("Message",Workspace)
A.Text = ((HasPlayed)and("You have played before")) or "You have not played before"
end)
Report Abuse
jonesj627 is not online. jonesj627
Joined: 06 Oct 2010
Total Posts: 1496
22 Jan 2014 08:46 PM
that code always prints out as the player has played,
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