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: Why wont this work?

Previous Thread :: Next Thread 
JohnMalakas is not online. JohnMalakas
Joined: 16 Nov 2012
Total Posts: 276
25 Feb 2013 02:12 AM
function onEnter(newPlr)
local nP = newPlr
local nPG = nP:findFirstChild("PlayerGui")
local gui = game.Lighting.MenuGui:clone()
gui.Parent = nPG
end

game.Players.PlayerAdded:connect(onEnter)


Its supposed to give the Gui to the player when he/she enters the server. But its not...

WHY???????

The debugger picks up no errors.
Report Abuse
captinsoap is not online. captinsoap
Joined: 24 Jan 2010
Total Posts: 9570
25 Feb 2013 02:21 AM
MenuGui:Clone()

i think clone has a capital.

~«im gonna eat you ok»~
Report Abuse
JohnMalakas is not online. JohnMalakas
Joined: 16 Nov 2012
Total Posts: 276
25 Feb 2013 02:28 AM
Ive done it both ways on scripts and its worked. But Ill try giving it a capital.


~Build Master John~
Report Abuse
JohnMalakas is not online. JohnMalakas
Joined: 16 Nov 2012
Total Posts: 276
25 Feb 2013 02:40 AM
It didnt work.


~Build Master John~
Report Abuse
xXxMoNkEyMaNxXx is not online. xXxMoNkEyMaNxXx
Joined: 03 Oct 2008
Total Posts: 3120
25 Feb 2013 02:48 AM
The PlayerGui probably doesn't exist yet. Use the new WaitForChild member function! *thumbs up*
Report Abuse
JohnMalakas is not online. JohnMalakas
Joined: 16 Nov 2012
Total Posts: 276
25 Feb 2013 02:52 AM
Ohhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh.

Thank you.


~Build Master John~
Report Abuse
dyudabomb is not online. dyudabomb
Joined: 06 Jun 2010
Total Posts: 113
25 Feb 2013 08:48 AM
I have this same issue only it's with a model... :/
Report Abuse
stardoctor0999 is not online. stardoctor0999
Joined: 06 Aug 2010
Total Posts: 425
25 Feb 2013 08:57 AM
repeat wait() until object -- You don't need ~= or == because just declairing object will make it want to search for that object to be existant, like so.

repeat wait() until game.PlayerGui

I suppose it could also be applied to a model.
Report Abuse
sammy1229 is not online. sammy1229
Joined: 05 Aug 2010
Total Posts: 669
25 Feb 2013 11:48 AM
game.Players.PlayerAdded:connect(function(newPlr)
repeat wait() until player.PlayerGui
local gui = game.Lighting.MenuGui:clone()
gui.Parent = player.PlayerGui
end)

Don't make it too complicated, star. This is ALL YAH NEED
Report Abuse
sammy1229 is not online. sammy1229
Joined: 05 Aug 2010
Total Posts: 669
25 Feb 2013 11:49 AM
game.Players.PlayerAdded:connect(function(newPlr)
repeat wait() until newPlr.PlayerGui
local gui = game.Lighting.MenuGui:clone()
gui.Parent = newPlr.PlayerGui
end)

sorry i forgot that you use newPlr instead of player
Report Abuse
thecaptain97 is not online. thecaptain97
Joined: 17 Jun 2010
Total Posts: 4987
25 Feb 2013 12:06 PM
game.Players.PlayerAdded:connect(function(ply)
repeat wait() until ply:findFirstChild("PlayerGui")
game.Lighting.MenuGui:clone().Parent = ply.PlayerGui
end)


findfirstchild prevents it randomly erroring.
Report Abuse
H1998 is not online. H1998
Joined: 30 Mar 2009
Total Posts: 3336
25 Feb 2013 12:11 PM
You are all old school people....

game.Players.PlayerAdded:connect(function(ply)
ply:WaitForChild("PlayerGui")
game.Lighting.MenuGui:clone().Parent = ply.PlayerGui
end)


Wait for child is the new trend!
Report Abuse
thecaptain97 is not online. thecaptain97
Joined: 17 Jun 2010
Total Posts: 4987
25 Feb 2013 12:12 PM
WaitForChild was actually added as a Method? When was this?
Report Abuse
Bloximity is not online. Bloximity
Joined: 27 Aug 2012
Total Posts: 9
25 Feb 2013 12:14 PM
@Captain
Quite a while ago. I've never used it though.
Report Abuse
thecaptain97 is not online. thecaptain97
Joined: 17 Jun 2010
Total Posts: 4987
25 Feb 2013 12:19 PM
I've always known it as a Function the admins put in the top of their Code.


I still like repeat wait() until object better though....

I mean that's basically all WaitForChild does, I don't see why it was added.
Report Abuse
H1998 is not online. H1998
Joined: 30 Mar 2009
Total Posts: 3336
26 Feb 2013 08:49 AM
Because it is not like a loop, but an event that is fired. Where events are kind of better than loops in terms of CPU.
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