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

Table item is not a valid member of Players, how do I solve it?

So, for my game, I started working on the elimination system, however I'm getting an error I can't seem to find an answer to. Any help?

Also, the output error is at the bottom.

local playingList = game.Teams.Playing:GetPlayers()

playerTable = {
	
}

for i, v in pairs(playingList) do
	
	table.insert(playerTable, playingList[i].Name) 
	print(playingList[i].Name)
	
end

local smallestValue = math.huge
local smallestPlayer = nil	

for i, v in pairs(playerTable) do
	
	currentPlayer = v
	
  	if game.Players.currentPlayer.PlayerGui.ScreenGui.ProgressBar.Config.Value < smallestValue then
   	smallestPlayer = game.Players.currentPlayer
   	smallestValue = game.Players.currentPlayer.PlayerGui.ScreenGui.ProgressBar.Config.Value
	print(smallestValue)
  	end
end

Output error:

  00:09:20.311 - currentPlayer is not a valid member of Players

3 comments

0

i = number, v = object. So, it should be v.Name, if you're trying to put the name of the player in the table.

0

I'll try this. Thanks!

0

Same output. I also made a little edit at the top if you wanna take a look.

1 answer

Feeling lazy so I won't explain what's going on but here's the new script.


for i, v in pairs(playerTable) do
	
	currentPlayer = game.Players:FindFirstChild(v)
	
  	if currentPlayer.PlayerGui.ScreenGui.ProgressBar.Config.Progress.Value < smallestValue then
   	smallestPlayer = currentPlayer
   	smallestValue = currentPlayer.PlayerGui.ScreenGui.ProgressBar.Config.Progress.Value
	print(smallestValue)
  	end
end

1 comment

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