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
 

Why doesn't this work? :)

Previous Thread :: Next Thread 
yoshimaster240102 is not online. yoshimaster240102
Joined: 14 Apr 2012
Total Posts: 470
19 Nov 2013 12:35 PM
game.Players.PlayerAdded:connect(function(plr)
plr:WaitForDataReady()
if plr.Name == "yoshimaster240102" then
game.Workspace.TXT.Value = plr:LoadString("LastSes")
end
end)

game.Players.PlayerRemoving:connect(function(plr)
if plr.Name == "yoshimaster240102" then
plr:SaveString("LastSes", game.Workspace.TXT.Value)
end
end)

This is in a normal script inside a frame inside a gui.
Report Abuse
yoshimaster240102 is not online. yoshimaster240102
Joined: 14 Apr 2012
Total Posts: 470
19 Nov 2013 12:38 PM
Also, I tested in a server not play solo. Still didn't work.
Report Abuse
breuning is not online. breuning
Joined: 30 Oct 2008
Total Posts: 4268
19 Nov 2013 12:40 PM
function DPwait(pl)
while not pl.DataReady do
wait()
end
end


game.Players.PlayerAdded:connect(function(plr)
DPwait(plr)
if plr.Name == "yoshimaster240102" then
game.Workspace.TXT.Value = plr:LoadString("LastSes")
end
end)

game.Players.PlayerRemoving:connect(function(plr)
if plr.Name == "yoshimaster240102" then
plr:SaveString("LastSes", game.Workspace.TXT.Value)
end
end)


not sure if thats the problem, but WaitForDataReady is kinda buggy
Report Abuse
yoshimaster240102 is not online. yoshimaster240102
Joined: 14 Apr 2012
Total Posts: 470
19 Nov 2013 12:41 PM
Um, WaitForDataReady, has always worked for me, so that couldn't be the problem. Ill just make a save button and a load button, but thank you for your time.

--Thread Closed--
Report Abuse
Quorum is not online. Quorum
Joined: 25 Oct 2013
Total Posts: 4680
19 Nov 2013 12:45 PM
@Yoshi,
1) I don't see why you're putting the script in a GUI when you could simply put it in Workspace (or use one of the new storage related services). You would also find that if you were the first person there, then the 'PlayerAdded' event wouldn't fire as you joined before the script ran.
2) I wouldn't advise using the 'PlayerRemoving' event with data persistence as there have been cases where the player's data hasn't saved correctly.
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