Im getting a error in the world.add_child(grassEffect).

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

func _process(delta):
	if  Input.is_action_just_pressed("attack"):
		var GrassEffect = load("res://Effects/GrassEffect.tscn")
		var grassEffect = GrassEffect.instance()
		var main = get_tree().current_scene
		world.add_child(grassEffect)
		queue_free()

  

Im watching the HeartBeast tutorial, and get the error:
The identifying “world” isn’t declared in the current scope
But when he did it it worked smoothly! Please help…

:bust_in_silhouette: Reply From: zaid645

For that case, I change world.add_child(grassEffect) with get_parent().add_child(grassEffect)

I am using godot 3.5.2. I don’t know will it can use in 3.5.1, but you can try it.