Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

GetPlayerFromCharacter is not a valid member of Player,what does that mean?

I'm using just using a normal script not a Local Script and I got a error:

GetPlayerFromCharacter is not a valid member of Player

game.Players.PlayerAdded:connect(function(Player)
	Character = Player:GetPlayerFromCharacter(character)
	print(Character.Name)
	for Number,LocalScripts in pairs (script:GetChildren()) do
		LocalScripts:Clone().Parent = Character
		LocalScripts.Disabled = false
		print(Player.Name,"now has",LocalScripts)
	end

end)

2 answers

✓ Accepted answer

You have it backwards. The PlayerAdded event returns the Player, not the Character. In your case, you would say: Character = Player.Character

The GetPlayerFromCharacter method returns get the Character's (game.Workspace) Player (game.Players).

1 comment

0

Thanks,but now that for some reason the LocalScript won't get cloned in the character.

Might not be the problem, but whats character? Character = Player:GetPlayerFromCharacter(character) You explained what Character with a Capital C is, whats character with a lowercase C, looks like it would be:

game.Workspace.Player

Oh, and btw, it looks like you need local variables.

This discussion is preserved as it was. New answers, comments, and votes are closed.