Uncertainty about obtaining an instance

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? Keep it simple and clear!
    I want to know if the script knows the difference between 2 instances even if they have the exactly same propertys and name, evething is the same.
  2. What is the issue? Include screenshots / videos if possible!
    no issue just a doubt
  3. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    any ill try something later if i get answered
    After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that itā€™s easier for people to help you!

Would anyone know if I create a script with a loop and a table that adds some characters from the workspace and recognizes them to determine if that entity is alive, meaning still in the workspace, and it works? However, shortly after, if that character within the table is removed, the script will understand that itā€™s no longer the same instance in the table and will add the ā€˜newā€™ one back into the table?

Example:

local Things = {}
while true do
	for i,v in pairs(workspace:GetChildren()) do
		if not table.find(Things,v) then
			table.insert(Things,v)
		end
	end
	wait(5)
end

--Does this will re add my char if it get destroyed and re created even if it is the "same"

Please if you know the answer, explain me in details i am alittle confused about this

1 Like

just use a property Changed listener for the parent of the things you want to check

1 Like

How would that work? That listens for properties and not children

you listen for the property ā€˜Parentā€™ of each of the parts, so when it is removed from the workspace a new one is added

1 Like

I mean, thatā€™s a solution, but I didnā€™t get it yet. What exactly defines the difference between your player character created before you reset and after to a script?

I guess iā€™m confused on what you want here, if you are trying to just check if a player died, then you can use the Humanoid.Died listener

im not looking for a solution, im just trying to understand whats the difference to a script of a instace cloned and the original one.

Itā€™s like 2 different Instance.new(ā€œBasePartā€) with same names, thatā€™s the difference

scripts would always know the difference between two different instances since they are two different instances

I misspelled it. I was trying to say the difference between two identical instances.

two identical instances are still two separate instances

the difference is their pathId and where in memory they are stored

so if i do

local part1 = Instance.new("Part",workspace)
local part2 = part1:Clone()
part2.Parent = workspace

local Things = {}

for i,v in pairs(workspace:GetChildren()) do
	if not table.find(Things,v) then
		table.insert(Things,v)
	end
end

it would get them both?

1 Like

ohhh thank you ill search about it

yes you would be able to get both

yes if you printed ā€œthingsā€ after looping it would print {Part, Part} (ignoring other instances of course)

print(Things)

k got it tyall i was confused about that thing of identical instances are still not the same for a script.

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