this is my code but I keep getting this error: ServerScriptService.Script:5: attempt to index nil with 'Character'
01 | game.Players.PlayerAdded:Connect( function (player) |
02 | print (player.name "joined" ) |
03 | end ) |
04 |
05 | if not player.Character then |
06 | print ( "waiting for character" ) |
07 | player.CharacterAdded:wait(); |
08 | char = player.Character |
09 | else |
10 | char = player.Character |
11 | end |
put your if statement inside the function. Your if statement does not know what player is because the player is a parameter of the function and it is only available for code inside the function (someone please explain this better).