Expected statement, found "." instead

Godot Version

4.3.stable

Code

extends AudioStreamPlayer

func play(from_position=0.0):

randomize()
pitch_scale = randf_range(0.6, 2.4)

.play(from_position)

Question

This code is from a tutorial made in 3.4 and there is something that has changed, can somebody tell me how to fix this?

Hi,

You need to call play on a variable, or the class itself. The . sign alone cannot work like this.
So you’d need something like:

play(from_position)

Or like this:

some_variable.play(from_position)

I believe you want the first one as your script extends AudioStreamPlayer.

1 Like