local character = game.Workspace.Player1 local player = game.Players:GetPlayerFromCharacter(character) if player then print("Player is " .. player.Name) else print("Player doesn't exist!") end
One way to fix this would be to use :WaitForChild() now I'm not sure if this is the best method, but it works :)
local character = game.Workspace:WaitForChild("Player1") local player = game.Players:GetPlayerFromCharacter(character) if player then print("Player is " .. player.Name) else print("Player doesn't exist!") end
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.