Let’s say I have two parts directly in the workspace which were both named “Part” and had the exact same properties. How would I identify which is which?
If I did:
game.Workspace.Part:Destroy()
it would delete one of them, but if I added the part that was just deleted back, and ran it again, it might delete the other?
How do I identify each part without renaming them?
What @ThanksRoBama means is we need more detail to best fix your example.
Are you trying to add and remove Parts in a build game, add or remove random Parts in the workspace, or some other kind of situation. It all depends on how you intend using it.
You may need to add these items to a table, or as @Dev4q mentioned, insert an IntValue into each Part, or you may need to rename each Part.
game.Workspace.Part:SetAttribute("select", true)
for k, v in pairs(game.Workspace:GetChildren()) do
if v:GetAttribute("select") then print("found") end
end
Could work. Won’t let you select specific parts but will discern one of X identical parts in the workspace.