Health isnt updateing?

extends Node2D
var hit = null

func _on_explosion_body_entered(body):
	hit = body.hp
	print(hit)
	print(body)
	hit = hit - 50
	body.hp_bar.value = hit
	print(hit)

for context this is the function of a bomb and it is placed as a instanced scene on top of the players position however it doesn’t do damage aka change the players hp var so i don’t understand its almost like the bomb gdscript file has read only perms to the player hp value like what?!?!

is this the full code?
is this script placed on the bomb or the player?

fixed by using body.hp = body.hp - 50 instead

mark as solved. also, it’s simpler to write:

body.hp -= 50
it’s even simpller to write a takeDamage() function:

func takeDamage(amount):
  body.hp -= amount

# then just call it when needed:
takeDamage(50)
``