I made a points system and i made a coin func _on_body_entered(body: Node2D) → void:
var game_manager = %Game_Manager
game_manager._points()
queue_free() that code calls func _points():
stringnum += 1
queue_free()
string = string + str(stringnum)
$“../CharacterBody2D/Camera2D/Label”.text = string but and it works the first time but the second coin i collect doesnt work it just gives me the error Attempt to call function ‘_points’ in base ‘null instance’ on a null instance.
From the code you pasted there’s a queue_free() inside _points(), and _points() lives on your Game_Manager. So collecting the first coin frees the Game_Manager itself. That’s why the second coin gets “null instance”, the manager is literally gone.
The queue_free() belongs to the coin, not the manager. Delete the one inside _points() and keep the one in the coin’s _on_body_entered after calling the manager: