So I was troubleshooting in my game currently in development and decided to try to print the player's name in a localscript.
https://gyazo.com/f4b95fcc6a3bceee9c09adcaed39ffc9
Nothing prints in the output, not even 'nil' or an error.
So I was troubleshooting in my game currently in development and decided to try to print the player's name in a localscript.
https://gyazo.com/f4b95fcc6a3bceee9c09adcaed39ffc9
Nothing prints in the output, not even 'nil' or an error.
Character isn't a valid Instance of a Player, it's actually a property. And what you are doing is waiting for a child named "Character" to exist inside the Player. You would have to do Player.Character, but since you call that before the character actually loads, you can do a simple condition written below.
local Character = Player.Character or Player.CharacterAdded:Wait()
But the character and humanoid lines aren't really relevant to the print line not working, sorry if I was unclear about that, thanks for the tip though. Would you happen to know why the print isn't working?
It's because you are using WaitForChild which is constantly yielding the rest of your code since the Character will never be a valid member of the Player.
Ohhhh I understand now thanks
This discussion is preserved as it was. New answers, comments, and votes are closed.
3 comments
Where's the script located, is there any infinite yields in the output?
There is an infinite yield, is that a problem? Also the script is located in StarterPlayerScripts.
So this is the infinite yield except I think it's irrelevant since it's talking about the character line https://gyazo.com/11e190e9177250b4595621e83dfdf1ee