Standalone Lambdas Cannot be Accessed Error

GODOT 4 Latest Version
I keep getting the Standalone Lambdas Cannot be Accessed Error and can’t seem to fix it

Here’s my code:

because _on_timer_timeout is indented it’s treated as if you are creating the function within _on_button_pressed, which isn’t allowed like this. Remove the tab at the start

thanks but i changed line 10 to Callable and that fixed a lot of errors but this was the result

Better to use the 4.x connection style, make sure to paste your scripts instead of screen shots. The error message says you are missing a closing parenthesis )

timer.timeout.connect(_on_timer_timeout)
1 Like

now i have theese errors
Line 21:Invalid argument for “connect()” function: argument 2 should be “Callable” but is “res://level_s.gd”.
Line 21:Cannot pass a value of type “String” as “int”.
Line 21:Invalid argument for “connect()” function: argument 3 should be “int” but is “String”.
Line 26:Identifier “button” not declared in the current scope.
Line 28:Identifier “button” not declared in the current scope.

All of these are from using the old 3.x connect style. On line 21 use this instead

timer.timeout.connect(_on_timer_timeout)

button was not declared in your func _on_timer_timeout(), I’m not sure how you want to transmit a button to the timer, maybe bind it to the previous connect again.

1 Like

Thanks so much

I have a question after running i got the red error at the bottom the yellow are fine and have been there

Your timer hasn’t been made yet. It cannot be added as a child

so what do i do

seems like your best bet is to remove all timer related code in _ready, since you are doing all your timer effects in the other _on_button_pressed function.

1 Like

your right i moved it to fix another error and never moved it thanks

but now my timeout function isn’t happening

heres my current scene tree
image

Show your code snippet again after the modifications you made.

Thanks but I fixed it it wasn’t with my code on that script