I have two parts:
One part adds player to table on touch
Two part removes player to table on touch
The problem is that you must have index number of the thing to remove it, but I can’t do that
Remove:
TableRemove.Touched:Connect(function(hit)
if hit.Parent:FindFirstChild("Head") and game.Players:FindFirstChild(hit.Parent.Name) then
local p = game.Players:FindFirstChild(hit.Parent.Name)
if table.find(PlayerTable,p) then
table.remove(PlayerTable,p)
end
end
end)
Add:
TableAdd.Touched:Connect(function(hit)
if hit.Parent:FindFirstChild("Head") and game.Players:FindFirstChild(hit.Parent.Name) then
local p = game.Players:FindFirstChild(hit.Parent.Name)
if not table.find(PlayerTable,p) then
table.insert(PlayerTable,p)
end
end
end)