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.
Remember to use LocalScript
you can use CharacterAdded:Wait()
(this wait for character added.)
example:
1 | local char = game.Players.LocalPlayer.Character or game.Players.LocalPlayer.CharacterAdded:Wait() -- Wait for character added |
You can try this:
1 | local player = game.Players.LocalPlayer |
2 | local playergui = player:WaitForChild( "PlayerGui" ) -- wait for player gui, for no errors |
3 | local char = player.Character or player.CharacterAdded:Wait() |
Wiki pages:
do not use
variable = value
uselocal variable = value
Hope it helped :)
this is the part where i got stuck
1 | player = game.Players.LocalPlayer |
2 | playergui = player.PlayerGui |
3 | char = player.Character |
how would i go about on fixing this because it ends up saying character is nil