Answered by
8 years ago Edited 8 years ago
One way to fix this would be to use :WaitForChild() now I'm not sure if this is the best method, but it works :)
1 | local character = game.Workspace:WaitForChild( "Player1" ) |
2 | local player = game.Players:GetPlayerFromCharacter(character) |
5 | print ( "Player is " .. player.Name) |
7 | print ( "Player doesn't exist!" ) |
Elaborate
The error "Player1 is not a valid member of Workspace" is displaced because the script ran before the character loaded, so the player wasn't part of Workspace.