Change instance variable created via fire bullet behavior correctly

This is the segment that is not working correctly:

What I want to do, is to create a bullet, and then set its team and damage. The team should later be used to determine who the bullet can hit.

What seems to actually happen is that the team and damage variable on the scene gets changed by whoever last fired a bullet (the friendly and enemy units have the same bullet creation logic as the player).

I don’t understand why, as I understand the GDevelop documentation, when you create an object and then set variables, GDevelop should limit the scope to the instance you just created.

When you have multiplayer game with Z key pressed
How you know which player pressed Z?

You need additional condition
You are firing from guns that is owned by some player
Or at least arms i guess

You could give this arms team variable and set bullet team to arms team and you are done

OK I’ve tried firing a bullet into nowhere and tracking its variable in the debugger. It is not changing teams. So the issue is in the damage event. I’ve tried making it 2 separate events with no subevents:

But it still doesn’t work. The “AllUnits” group includes the player, enemy and friendly objects.

Managed to fix it:

Gotta remember to always use repeats when I want to isolate single instances. Maybe someone can learn from my mistakes.