Hello. I’m trying to make a system which makes terrain that had been modified by another script restore itself. It works well except once the terrain restores itself, it restores previously restored terrain because of save which is a table containing the terrain values such as position, material and such.
I’ve tried to prevent this with table.remove as you can see below, but it doesn’t work.
while wait(10) do
for i,save in terrsave do
if (save[1] - wheelpart.Position).Magnitude > 30 then
terrain:FillBall(save[1], save[2], save[3])
table.remove(terrsave, table.find(terrsave, save))
print(save)
wait(.1)
end
end
end
print(save) still prints after save was removed with table.remove(terrsave, table.find(terrsave, save))
Within the for-loop, you aren’t actually changing the value of save, instead only whether or not it is in the table. You should instead be checking the terrsave table (potentially using table.find) in order to determine if the table has been successfully removed.
i dont want to check or change the value of save. i want to remove save entirely, but table.remove(terrsave, table.find(terrsave, save)) is failing to do so.