Error calling method from signal 'body_entered'

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Xero

I made a kinematic body that collects gems which are areas (children of spatial)

extends Node 
var score = 0
var score_per_gem = 1

func _on_gem1_body_entered():
   score = score+score_per_gem
   get_tree().set_free()


func _on_gem2_body_entered():
   score = score+score_per_gem
   get_tree().set_free()


func _on_gem3_body_entered():
   score = score+score_per_gem
   get_tree().set_free()


func _on_gem4_body_entered():
   score = score+score_per_gem
   get_tree().set_free()

and so on till gem9
Then i got this error in the debugger:
E 0:00:02.793 emit_signal: Error calling method from signal ‘body_entered’: ‘Spatial(gems.gd)::_on_gem2_body_entered’: Method expected 0 arguments, but called with 1…
<C++ Source> core/object.cpp:1228 @ emit_signal()
Tried adding body as an argument, game freezed and gave this message in debugger

:bust_in_silhouette: Reply From: RazorSh4rk

Body enter signals take the body as an argument, you can change your functions to _on_xy_body_entered(body).

Tried your answer, game freezed and gave this message in debugger
error while running the game
Debugger

Thanks btw

Xero | 2020-06-15 20:01