How would I identify an Instance?

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?

1 Like

You can have value inside the part number, string etc And then check every part’s value to identify. this will have no visual effects at all

Please explain the situation where you need this. Having something concrete to work with makes it easier to give an example.

4 Likes

Literally the example I gave lol…

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.

3 Likes
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.

I advise listening to @ThanksRoBama & @Scottifly. Use-case is important.

Eh i just used debug Id

3O chars

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.