Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

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

Asked by 10 years ago

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

Log in to vote
1
Answered by
Aethex 256 Moderation Voter
10 years ago

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).

0
Thanks,but now that for some reason the LocalScript won't get cloned in the character. kevinnight45 550 — 10y
Ad
Log in to vote
-3
Answered by
Vividex 162
10 years ago

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.

Answer this question