# queue\_free not working

**URL:** <https://forum.godotengine.org/t/queue-free-not-working/147958>\
**Category:** Programming\
**Tags:** godot-4\
**Created:** [December 1, 2026, 3:41pm UTC](https://forum.godotengine.org/t/queue-free-not-working/147958 "2026-12-01T15:41:49Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![PeanutRoll](https://forum.godotengine.org/user_avatar/forum.godotengine.org/peanutroll/32/87533_2.png) [@PeanutRoll](https://forum.godotengine.org/u/PeanutRoll)\
**Post date:** [December 1, 2026, 3:41pm UTC](https://forum.godotengine.org/t/queue-free-not-working/147958/1 "2026-12-01T15:41:49Z")

</div>

### Godot Version

`4.6.2`

### Question

I am making a game where you have to click tiles and I need to delete the tiles (StaticBody2Ds) after they have been clicked but queue\_free() doesn’t do anything

(I am new to godot and don’t know much gdscript but the internet said to use queue\_free)

I don’t know how to properly send my code but here:

extends StaticBody2D

@onready var animated\_sprite\_2d: AnimatedSprite2D = $AnimatedSprite2D  
@onready var timer: Timer = $Timer

var IsClicked = false

func \_on\_input\_event(viewport: Node, event: InputEvent, shape\_idx: int) → void:  
if Input.is\_action\_just\_pressed(“click”) and not IsClicked:  
animated\_sprite\_2d.play(“clicked”)  
IsClicked = true

func start\_the\_timer():  
if IsClicked:  
timer.start()

func \_on\_timer\_timeout() → void:  
queue\_free()

---

<div class="post-metadata">

**Author:** ![tibaverus](https://forum.godotengine.org/user_avatar/forum.godotengine.org/tibaverus/32/43649_2.png) [@tibaverus](https://forum.godotengine.org/u/tibaverus)\
**Post date:** [December 1, 2026, 4:18pm UTC](https://forum.godotengine.org/t/queue-free-not-working/147958/2 "2026-12-01T16:18:48Z")

</div>

You never start the timer.

---

<div class="post-metadata">

**Author:** ![wasd\_person](https://forum.godotengine.org/letter_avatar_proxy/v4/letter/w/3da27b/32.png) [@wasd\_person](https://forum.godotengine.org/u/wasd_person)\
**Post date:** [December 1, 2026, 4:26pm UTC](https://forum.godotengine.org/t/queue-free-not-working/147958/3 "2026-12-01T16:26:28Z")

</div>

how long is the timer set for in the inspector, or try adding a time duration in the timer.start

```gdscript
func start_the_timer() -> void: #this function will not return anything
    if IsClicked:
        timer.start(1.0) # this will have a duration of 1 second

```

your start the timer function is not marked void, meaning it needs to return information, if you don’t want it to return anything the mark it will void.

---

<div class="post-metadata">

**Author:** ![tibaverus](https://forum.godotengine.org/user_avatar/forum.godotengine.org/tibaverus/32/43649_2.png) [@tibaverus](https://forum.godotengine.org/u/tibaverus)\
**Post date:** [December 1, 2026, 4:30pm UTC](https://forum.godotengine.org/t/queue-free-not-working/147958/4 "2026-12-01T16:30:57Z")

</div>

That’s not the problem here. The problem is that, based on the provided script, the `start_the_timer` function is never called, hence the timer never starts.

---

<div class="post-metadata">

**Author:** ![wasd\_person](https://forum.godotengine.org/letter_avatar_proxy/v4/letter/w/3da27b/32.png) [@wasd\_person](https://forum.godotengine.org/u/wasd_person)\
**Post date:** [December 1, 2026, 5:34pm UTC](https://forum.godotengine.org/t/queue-free-not-working/147958/5 "2026-12-01T17:34:36Z")

</div>

is the whole script here and is the function global? that could be happening, but you also have a point tibaverus

---

<div class="post-metadata">

**Author:** ![Vachivenza](https://forum.godotengine.org/user_avatar/forum.godotengine.org/vachivenza/32/78971_2.png) [@Vachivenza](https://forum.godotengine.org/u/Vachivenza)\
**Post date:** [December 1, 2026, 6:12pm UTC](https://forum.godotengine.org/t/queue-free-not-working/147958/6 "2026-12-01T18:12:06Z")

</div>

For getting help much easier and smooth, please do format your code by hightlighting it and pressing Ctrl + E while making the forum post. It is hard to read it in plain text and formatting it would get more people to try and help you.

```GD
class_name CodeExample

var placeholder_var: float = 12

```

And to solve your issue, the function start\_the\_timer() is never called and that’s why the expected behaviour is not happening. You can call the function at \_on\_input\_event(). Also make sure to print something at the end there as well to make sure \_on\_input\_event() function is being called.

```GD
func _on_input_event(viewport: Node, event: InputEvent, shape_idx: int) → void:
    if Input.is_action_just_pressed(“click”) and not IsClicked:
        animated_sprite_2d.play(“clicked”)
        IsClicked = true
        start_the_timer()
        print("Started the timer!")

```

If nothing is happening still, the other problem could be that Timer’s timeout signal is not connected to the on\_timer\_timeout() function so make sure the signal is connected as well.
