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: Server scripts accessing Player.PlayerGui

Previous Thread :: Next Thread 
ajmhm1111 is not online. ajmhm1111
Joined: 22 Jun 2013
Total Posts: 164
15 May 2014 12:21 PM
Hello,

Currently I have this very basic script:

function onPlayerAdded(player)
repeat wait() until player:FindFirstChild("PlayerGui")
print"Found PlayerGui!"
--other code
end
game.Players.PlayerAdded:connect(onPlayerAdded)

However it never gets to the print statment, this is in a global script not disabled in Workspace.

Any help?

--ajmhm1111
Report Abuse
wrightracer3n is not online. wrightracer3n
Joined: 09 Nov 2011
Total Posts: 964
15 May 2014 12:24 PM
Why don't you do this;

game.Players.PlayerAdded:connect(function(player)
player:WaitForChild('PlayerGui')
print('Found PlayerGui!')

end)

Also, you did the print function wrong. It's print('WHATEVER IN HERE')

- WrightRacer3n
Report Abuse
ajmhm1111 is not online. ajmhm1111
Joined: 22 Jun 2013
Total Posts: 164
15 May 2014 12:27 PM
@wrightracer3n

First of all I put it in a separate function and connection line so that slightly less beginner scripters who do not know about anomalous functions could understand it.

Secondly in lua in a function only accepts one parameter that is a string that you do not need to concatenate with another string you can simply provide it the information without using the parenthesis.

For example:

print"Hello Word" --> Hello Word

print"Hello World, my name is".."ajmhm1111" -->Error

Hope this meant you learnt something :D

Although could someone answer my question :)

--ajmhm1111
Report Abuse
wrightracer3n is not online. wrightracer3n
Joined: 09 Nov 2011
Total Posts: 964
15 May 2014 12:32 PM
Well, sorry there bucko! Didn't really seem like anything intermediate to me I mean why would you want something that prints if it finds PlayerGui in the first place? o_O PlayerGui will always be inside Player and having a print function does nothing .. print('Hello, World!') Oh so useful. Didn't bother reading the rest of what you put. #RealisticChuckECheeses

Hope you learned that you're rude today. K, bai. :D

- WrightRacer3n
Report Abuse
ajmhm1111 is not online. ajmhm1111
Joined: 22 Jun 2013
Total Posts: 164
15 May 2014 12:38 PM
Hello,

I apologies for being rude.

The only reason I decided to put a print statement to see if the script was progressing to the next lines of code.

The reason I may of had a small rant was to make sure that other people didn't focus on those possible errors of why the basic script may not be working.

Sorry for that,

--ajmhm1111

Report Abuse
Qwertygiy is not online. Qwertygiy
Joined: 09 Aug 2009
Total Posts: 89
15 May 2014 12:47 PM
Hi, ajmhm1111,


Your script appears to work just fine for me. I copied it and pasted it into a global script in a blank Studio place, started a test server, started a test player, and in the, emphasis here, SERVER window, it printed "Found PlayerGui!"

I can think of two reasons why it may have not worked for you:

A) You only looked in the Test Player window, not the Test Server window.

B) You used Test Solo, which does not properly trigger the PlayerAdded event.

I hope this helped! And I apologize for my friend wrightracer. I admit, I didn't know you could do that with print either. I wouldn't use it for stylistic reasons, but good to know.
Report Abuse
ajmhm1111 is not online. ajmhm1111
Joined: 22 Jun 2013
Total Posts: 164
15 May 2014 12:51 PM
Thank you very much for replying.

I do admit I tried it in Studio as well, and it did work in there, I am sorry to say it does not work in Server mode (launched from Player). Is this because of the new security measures of ROBLOX would you think or something like that?

--ajmhm1111
Report Abuse
Qwertygiy is not online. Qwertygiy
Joined: 09 Aug 2009
Total Posts: 89
15 May 2014 12:59 PM
If it does not show up in the developer console in online mode, perhaps it is because the player hasn't fully loaded yet, so the output of the print doesn't get sent to the player. I can't say for sure that's what's happening, but I know that some really weird lack of communication can happen in the first few seconds after a player joins a game, especially but not only if they have a bad connection. Try adding an extra three seconds of wait time after the PlayerGUI has loaded and before the print line and see if that helps?
Report Abuse
wrightracer3n is not online. wrightracer3n
Joined: 09 Nov 2011
Total Posts: 964
15 May 2014 01:10 PM
print('I am sorry, OP. I just never used that weird print function before. Fo'give me man. Wrolololol..')

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