Why does this cause a nullptr?

The “AmmoAmount” variable had the value of 19 when the nullptr occured.

I tried having the variable have no set value but that didnt help either.

Your PlayerCharacter is a most probably a nullptr, check to make sure your playercharacter is valid before calling the “GetCurrentAmmo”.