I'm not sure why this is happening.
Basically, I'm trying to send a table through a remote event which tells the client what players are in the game. From this, I want to fill up a text box full of the names of the players.
playersRemote = game.ReplicatedStorage.playersExchange
playersRemote.OnClientEvent:connect(function(arg)
players = arg
for i=1,#players do
if players[i].Name == game.Players.LocalPlayer then
table.remove(players,i)
end
end
--Using the above code to take out the local player from the table
for i=1, #players do
script.Parent:FindFirstChild("plr"..i.."name").Text = players[i].Name
--This is where it says I'm trying to index a nil value
end
script.Parent.Visible = true
end)

11 comments
oh my deprecated cde
Thank you for pointing that out, but that doesn't help anyone. What part of my code is deprecated? I'm just trying to learn remote events and filtering enabled gameplay since I left roblox about a year ago.
connect is deprecated in favor of Connect & you should be using local variables
if players[i].Name == game.Players.LocalPlayer --> game.Players.LocalPlayer.Name, as for the nil part..you have a bunch of children of script.Parent named "plr1name", "plr2name", etc? Because that is what your script is currently doing but it doesn't quite match up with the question description
Thank you, and yes that's how my gui is laid out.
Okay, is the nil value players[i].Name or the FindFirstChild line?
It's on the find first child line
There are equal amounts of "plrname" as there are players? Maybe it will help if you look yourself in explorer to make sure they all exist
There can never be more than 4 players in my game, and because 1 of the players is the local player (and wont need to see themselves in the list), I've only put 3, so they are all there.
Or possibly you would require a WaitForChild in the event that they are being created while the loop is running
The error means either "script.Parent:FindFirstChild("plr"..i.."name")" doesn't exist or "players[i]" doesn't exist. Find out which one. I'm guessing the former.