The problem is found after debug(“One”). Since the following line doesn’t execute, BUT it works, sometimes it doesn’t make the correct reference, but when the entity moves a little bit, it starts to work.
Also previously I had a for but it didn’t work in any way.
What will be the error?
What you suspected is correct, if there is an entity inside. But apparently, checking, 3 objects came out. So on console I saw that those 3 objects are: 2 by the player and 1 by the enemy (which is the one with the script). It still fails, but it is almost unnoticeable