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

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

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

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)

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