I am trying to make a part that when touched, adds the players names to the table (For now I'm testing with just adding test with a value of test2 and I want it to print "testtesttest" but the game prints "Workspace.EnterSensor.Script:7:wrong number of arguments to 'insert' " and doesn't print anything, could someone please tell me why this is happening?
Here is the script (It's a server script located inside of a part which is located in the workspace):
PlayersTouching = {}
script.Parent.Touched:connect(function(hit)
if hit.Parent:FindFirstChild("Humanoid") then
local plr = workspace[hit.Parent.Name] --Access character from workspace.
local player = game.Players:GetPlayerFromCharacter(plr) --Access (plr)
table.insert(PlayersTouching, 1, "Test", "test2")
if table.getn(PlayersTouching, 1) == "test2" then
print("testtesttest")
end
end
end)
Please tell me if you have any idea why this is happening!

1 comment
getn is deprecated