My table isn't working

Hi, this is my first time scripting tables so as expected it didn’t work. I’m making a table to store ‘player1’ and ‘player2’ so that I can call them after a player dies, because before I had problems that the player loses its character when it dies so i’m hoping this will solve the problem. Here is the part of my script where I made the table:

local function startEvent()
	local plrs = {
	table.insert(plrs, standingOnArena1Player1)
	table.insert(plrs, standingOnArena1Player2)
	local player1 = table.find(plrs, standingOnArena1Player1)
	local player2 = table.find(plrs, standingOnArena1Player2)

What am I doing wrong? It seems like its not assigning the variables to the player as when I did player1.Character later in the script it said ‘attempt to index number with character’

I’d really appreciate any help!

table.find returns the index not the value. You don’t need to use .find at all because player1 is just standingOnArena1Player1

1 Like

So if i wanted to keep the value of ‘player1’ after the player dies, should i make a function that is called after the player dies, so it reassigns the variable? Because before I had problems with the players character getting destroyed so my script no longer worked after they player died