I have a portion of a script that whenever I do print(playerplate) it returns nil.

local currentplates = plateholder:GetChildren()
	for i, player in pairs(contestants) do
		if player and player.Character and #currentplates > 0 then
			local torso = player.Character:WaitForChild("Torso")
			local humanoid = player.Character:WaitForChild("Humanoid")
			local playerName = player.Name --This is the player's Name
			print (playerName) --This prints the players name
			local playerplate = currentplates.playerName --This finds the part whose name is the same as the players name
			print (playerplate) -- This prints the name of the part, which returns as nil

6 comments

0

try currentplates[playerName] if you try to index a variable through another variable.

0

or you could do local playerplate = currentplayes[player.Name] if that one above doesn't work

0

Hmm. I tried both and it still returns as nil.

0

What exactly are currentPlates children?

0

It seems like playerplate is an object and you're trying to print an object. Try this instead: print(playerplate.Name)

0

It appears that playerplate is a nil value and that is why it is still not working.