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: Wait until player has loaded

Previous Thread :: Next Thread 
Boopbot is not online. Boopbot
Joined: 11 Jul 2008
Total Posts: 2284
26 Sep 2014 12:28 AM
I have a local script in the playergui that never works when the player first loads the game. But if I remove the script and add it back, or disable is and re-enable it, it works. If there a way so that the script will wait until the player is fully loaded before activating?
Report Abuse
bob10110 is not online. bob10110
Joined: 09 Dec 2007
Total Posts: 679
26 Sep 2014 12:48 AM
Well, you could throw a line in there like

local c = player:WaitForChild(player.Character)

and it'll yield until the player's Character has loaded in.
Report Abuse
islandmaker2012 is not online. islandmaker2012
Joined: 07 Nov 2012
Total Posts: 9327
26 Sep 2014 12:57 AM
p = game.Players.LocalPlayer
repeat wait() until p and p.Character
wait()
--code
Report Abuse
bob10110 is not online. bob10110
Joined: 09 Dec 2007
Total Posts: 679
26 Sep 2014 01:07 AM
Come to think of it, my solution wouldn't work anyways. I'm not sure what made me think you could do that with WaitForChild(), guess I'm still a bit rusty when it comes to scripting knowledge.

WaitForChild() would have better use looking in the Workspace, and then we get into fun little edge cases that arise if a player with the same name as one of your Models enters the place. It's probably better for some other implementation that involves waiting until the player's Character property is not a nil value, like in the previous post.
Report Abuse
Boopbot is not online. Boopbot
Joined: 11 Jul 2008
Total Posts: 2284
26 Sep 2014 09:30 AM
Yea, I tried WaitForChild first and couldn't think of how to make it work. Thanks for the script though!
Report Abuse
DragonODeath is not online. DragonODeath
Joined: 02 May 2011
Total Posts: 1252
26 Sep 2014 09:31 AM
UMG ITS BOOPBOT
lrn2lua bro
we help u cuz we luv u
Report Abuse
ThatChristianGuy is not online. ThatChristianGuy
Joined: 14 Jun 2014
Total Posts: 1283
26 Sep 2014 10:40 AM
Just do

repeat wait(0) until player.Character


--ThatChristianGuy
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