I'm working on a game, and I'm trying to make a eating feature, I got the player's part down for the most part, but the food's script does not want to work it seems. I've tried so many different ways to make the food disappear once it's substance has reached 0 or less. sorry if the code below is hard to read, this is my first time making a game and my first time posting a question."eating food"+"yum!" are printed out each bite until the substance reaches 0 or less, then it prints out "eating food"+"food eaten"+"yum!" for each bite after that. Please let me know if there is a better way to do this
main

extends KinematicBody2D
func _on_FoodPH_eaten():
	print("signal1")
	food.visible = not get_node("Food").visible
	food.queue_free()

food

func Eating():
	Substance -= 1
	print("eating food")
	if Substance <= 0:
		Eaten()

func Eaten():
	emit_signal("eaten")
	print("food eaten")

player

func _input(event):
	if event.is_action_pressed("Bite"):
		for body in $Player.get_overlapping_areas():
			if body.is_in_group("Food"):
					Food.Eating()
					emit_signal ("Eat")
func _on_Player_Eat():
	Hunger += 2
	print("yum!")

Please place ~~~ before and after the code so that it will be formatted correctly here.

I usually copy/paste code here directly from the Godot editor to maintain the indentation.

    Hard to tell what's going on without more information. Which of those print statements is firing? Are any errors showing up in the console? What nodes are those scripts attached to (e.g., are that first excerpt that extends KinematicBody2D and the "player" section attached to different nodes)?

      soundgnome print "signal1" is the only one that doesn't activate at any time, and there are no errors. the(top) main script is attached to the parent node of both the food and player scripts. The (mid)food script is attached to a kinematicbody2D, and the (bottom)player script is attached to another separate kinematicbody2D node

        feara6 In that case maybe the eaten signal in food isn't connected to the _on_FoodPH_eaten method.

          soundgnome I connected it through the UI before, and it does seem to be connected when I check it.

          Guys I managed to fix it! Thanks for all the help!