Instantiation is an invalid call

Godot Version

Godot 4.1.4


I’m trying to create waves’ moves

Here’s the code:
for i in range(spring_number):
var x_position = distance_between_springs * i
var w = water_spring.instantiate()

And every time i try to test it, Godot tells me: Invalid call. Nonexistent function ‘instantiate’ in base ‘GDScript’. ( ╯°□°)╯ ┻━━┻
I have no idea what to do abt it. Please help

1 Like

Not too familiar with godot, but are you sure what you’re instantiating is a node?
It looks like godot is telling you that you’re trying to instantiate a piece of code. I’d try saving a node (with the script attached) and using that instead of whatever water_spring is.

As a note, including more context would help people help you.

Can you show how you define water_spring? It thinks it’s pointing to a GDScript (.gd file) but you want it to point to a PackedScene (.tscn file)


THANK U SO MUCH! I didn’t notice that back then. U’re amazing (ノ´ з `)ノ