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 » Scripters
Home Search
 

Re: Why won't this script work?

Previous Thread :: Next Thread 
Personatus is not online. Personatus
Joined: 06 Nov 2014
Total Posts: 14
16 Jul 2015 07:44 PM
game.Players.PlayerAdded:connect(function(player)
player:WaitForDataReady()
local hasplayed = player:FindFirstChild("PHPB4")
if hasplayed then
print("This player has joined my game before!")
else
print("The player is new!")
local playerGUI = game.Lighting.NewPlayer_GUI:Clone()
playerGUI.Parent = player.PlayerGui
local PlayerHasPlayedBefore = Instance.new("InitialValue", player)
PlayerHasPlayedBefore.Name = "PHPB4"
end
end)

There's never anything in the output when I go to test it.
Report Abuse
drink is not online. drink
Joined: 03 Mar 2008
Total Posts: 23
16 Jul 2015 07:50 PM
im not an expert on GUI's but what about making the GUI visible?
Report Abuse
Personatus is not online. Personatus
Joined: 06 Nov 2014
Total Posts: 14
16 Jul 2015 07:53 PM
"im not an expert on GUI's but what about making the GUI visible?"

That didn't work.

I think that it has something to do with waiting for the player's data to load since whenever I test it in Studio nothing ever prints.
Report Abuse
Personatus is not online. Personatus
Joined: 06 Nov 2014
Total Posts: 14
16 Jul 2015 08:11 PM
The issue was in the player:WaitForDataReady(). I'm not sure why, but when I removed that from the script and replaced it with wait(10), the script worked fine.

I also put "InitialValue" instead of "IntValue."
Report Abuse
Personatus is not online. Personatus
Joined: 06 Nov 2014
Total Posts: 14
16 Jul 2015 08:13 PM
Are there alternatives to using player:WaitForDataReady()? I don't want to just put in wait(10) because what if the player's computer is really quick or really slow?

game.Players.PlayerAdded:connect(function(player)
wait(10)
local hasplayed = player:FindFirstChild("PHPB4")
if hasplayed then
print("This player has joined my game before!")
else
print("The player is new!")
local playerGUI = game.Lighting.NewPlayer_GUI:Clone()
playerGUI.Parent = player.PlayerGui
playerGUI.Frame.Visible = true
local PlayerHasPlayedBefore = Instance.new("IntValue", player)
PlayerHasPlayedBefore.Name = "PHPB4"
end
end)
Report Abuse
TimeTicks is not online. TimeTicks
Joined: 27 Apr 2011
Total Posts: 27115
16 Jul 2015 08:14 PM
http://www.roblox.com/Forum/ShowPost.aspx?PostID=162506822


"Talk is cheap. Show me the code." - Linus Torvalds
Report Abuse
drink is not online. drink
Joined: 03 Mar 2008
Total Posts: 23
16 Jul 2015 08:15 PM
how are you able to test this?
Report Abuse
Personatus is not online. Personatus
Joined: 06 Nov 2014
Total Posts: 14
16 Jul 2015 08:17 PM
"http://www.roblox.com/Forum/ShowPost.aspx?PostID=162506822"

Thanks.
Report Abuse
Personatus is not online. Personatus
Joined: 06 Nov 2014
Total Posts: 14
16 Jul 2015 08:18 PM
"how are you able to test this?"

I've been testing by using Play Solo mode on Studio and then checking the output for any issues.
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • 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