Not sure why event keeps running after branch is false?

I’m trying to create a coin magnet system following up the endless runner tutorial. Everything works fine but after i call the event it won’t stop running it even if the branch is false.

I set up the magnet object when overlapped to call the magnet function.

Sorry in advance if my question is dumb:)

Every time a Magnet is overlapped by a RunCharacter you’re creating a new Magnet by means of the RunCharacter::Magnet event. The Magnet object being destroyed in Magnet::OnComponentBeginOverlap is the one being overlapped, not the new one. So, you’re essentially creating new magnets, destroying old ones, but there’s always a new instance that has recently set MagnetOn = true, which is why it doesn’t stop running (if the branch ever evaluates to false it’s probably just momentarily before a new magnet makes it true again).

I’m not sure what you mean by “it won’t stop running”; the event spawns a new actor and attaches it. Is this happening repeatedly?

If you’re wondering why the “OnComponentBeginOverlap” always results in spawning a new actor, it’s because it triggers MagnetAct, which sets “MagnetOn” to true, and then it triggers “Magnet”. So the branch is true every time.

Also, as a side note, you’re casting the same object to RunCharacter twice, you can just drag the “As Run Character” pin to both nodes.

Thanks a lot for your feedback, maybe i’m just misunderstanding, but i actually had 2 magnet blueprints, BP_Magnet and Magnet. I was calling BP_Magnet which sets the radius where coins get sucked to the player, and magnet just to call BP_Magnet into existence.

Is it happening because this BP_Magnet is still there after the function isn’t running?

heres the coin side if you need it.