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

Why am I getting "RexRicher is not a valid member of Players"?

Asked by 6 years ago
Edited 6 years ago

So when I run this script what I get is the error message "RexRicher is not a valid member of Players" But when I look in Players, My name is there as a player.

script.Parent.MouseButton1Click:connect(function(p)
    SelectedPlayer = script.Parent.Parent.TextBox.Text  -- Textbox text = RexRicher
    game.Players(SelectedPlayer).TeamColor = BrickColor.new(team)
    game.Players.LocalPlayer.PlayerGui.Classification.Enabled = false
end)

1 answer

Log in to vote
0
Answered by
Rare_tendo 3000 Moderation Voter Community Moderator
6 years ago

On line 3, you're supposed to use square parenthesis.

script.Parent.MouseButton1Down:Connect(function()
       SelectedPlayer = script.Parent.Parent.TextBox.Text
      game.Players[SelectedPlayer].TeamColor = BrickColor.new(team)
      game.Players.LocalPlayer.PlayerGui.Classification.Enabled = false
end)
Ad

Answer this question