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