I have a script that tells you what the character is. But it says the character is a nil value. I think its because im using the script before the character is made but i dont know how to fix that.
✓ ANSWER ACCEPTED
Character is nil value, pls help?
2 answers
✓ Accepted answer
Remember to use LocalScript
you can use CharacterAdded:Wait() (this wait for character added.)
example:
local char = game.Players.LocalPlayer.Character or game.Players.LocalPlayer.CharacterAdded:Wait() -- Wait for character added
You can try this:
local player = game.Players.LocalPlayer
local playergui = player:WaitForChild("PlayerGui") -- wait for player gui, for no errors
local char = player.Character or player.CharacterAdded:Wait()
Wiki pages:
do not use
variable = valueuselocal variable = value
Hope it helped :)
1 comment
0
Repeating until an object exists is not the way to go
this is the part where i got stuck
player = game.Players.LocalPlayer
playergui = player.PlayerGui
char = player.Character
how would i go about on fixing this because it ends up saying character is nil
1 comment
0
char = player.Character or player.CharacterAdded:Wait()
This discussion is preserved as it was. New answers, comments, and votes are closed.

3 comments
Put the script in the message with codebox.
Sorry, but scripting helpers community are not Vangas. If you want to fix your problem, put your script into script blocks and then post them
ok i sent the part where my script is broken