One blueprint isn't seeing the variable the same way as the other one

So I’m trying to track how many items have been collected and stop spawning them if too many have been collected. The following works fine, each time the player collects one it increments the number spawned variable, even after the character respawns at a checkpoint.

However, this one reports the number spawned variable as being 0 whenever the player respawns to bring the items back, and never reaches the maximum to stop spawning them.

I don’t understand, they should both be getting the variable from the same place so why is it different? I can only think that it’s because the second one loads up first, as everything is spawning in, but the Attempt to Spawn function is set to have a (currently) 0.2 second delay before it runs so that should already be delaying it enough for all the save functions to work properly.

Are you running that code on client? If do, client has no access to the game mode as it is only server side.

I don’t really know how to do online or multiplayer stuff, so it’s all whatever the default is as far as that’s concerned

There’s only one game mode. Put the variable in the player :slight_smile:

Just to be clear, I’m not actually trying to do anything online or multiplayer lol. Edit: I put it in the gamemode so that everything can access it, putting it in the player kind of does the opposite of what I want

No, not talking about multiplayer. But there is only one gamemode, so only one copy of your variable. If you want a separate variable for each player ( or spawned AI ), you need to put it in the player.

The specific problem I have is that they’re reading the same variable differently, I want it to be the same for both lol

Beg your pardon, see what you’re saying.

First thing. After that ++ you don’t need to expressly store the variable again, it’s already done by the ++

I don’t quite understand the logic. In the first graph, you’re not counting the number spawned, you’re counting the number picked up.

What is calling Attempt to Spawn?

yeah, Number Spawned is just an old name for the variable from when I was trying to use it to detect whether specific ones had been collected, which didn’t work even as well as this is now. The item spawner is the one from this video tutorial: https://www.youtube.com/watch?v=dbLFHflVleg and the Attempt to Spawn is part of that, it’s quite a large system so that’s probably the best I can explain it for now

Sorry, no idea. I think there’s something going on that’s not in these pictures…