i run to see if the key is available of freed, i want to it to pass the function when key is not available but it gives an error saying, invalid getting index(previously freed instance)"
here’s the script see if you could help
func checkifkeyininventory():
if key:
if key.position == Vector2(1085.5, 229.5) or key.position == Vector2(1087.5,304.5) or key.position == Vector2(1085.5,378.5):
makeslotempty(key)
body.animation = "OpenLock1"
body.play()
key.queue_free()
else:
print("nothing to change")