So I was trying to delete an object in Godot whenever a key is pressed. But it would not work. Can anybody help/fix it?

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

Code:

func _process(delta):  
 if Input.is_action_pressed("ui_accept"):
	queue_free()

Error: “The method “queue_free” is not declared is the current class.”

Script type: GDScript file

I don’t see any typo. What object does this script extend from ?

Inces | 2022-09-04 10:10

Today I came back and when you asked me this question, I wanted too so I added a extendblock to my TextEdit but all it did was make it space out, so I used a label. And it worked! It extends from Label.

TheRetroMemeCoder | 2022-09-04 12:06

:bust_in_silhouette: Reply From: creativeape
queue_free()

You typed it wrong :slight_smile: