(Solved) Parenting using matching Object Variables not working

How do I

make a parenting system using matching Object Variables?

What is the expected result

Both the Dummy and Hurtbox Objects have an object variable “ID”
In the level editor I want to be able to use the properties tab to assign ID numbers to Dummies/HurtBoxes.
In game all Dummy Objects should go to the position of the Hurtbox with a matching ID number.

What is the actual result

When trying to generalize my code to apply to all instances, it only ever applies to the first instance.
Sometimes tweaks to code make all Dummies go to one Hurtbox.
When brute forcing all ID matches the code works, but I don’t want to have to do this for every new instance.

Related screenshots

In this i have 3 instances of Dummy/HurtBox with matching ID variables.
Left = ID:1, Middle = ID:2, Right = ID:3

Brute forcing every ID match.


For some reason generalizing the code only applies to ID:1 but not 2 or 3.

Deleting the Dummy and HurtBox with ID:1 just applies to ID:2 now.

Do it this way. Note, the order of the ID check is important with this one:

Thanks. Worked like a charm.