0 votes

I was hoping to use the onready keyword to to load a variable but I get an error that says:

SCRIPT ERROR: Parse Error: Unexpected "Identifier" in class body.

Here is the code:
onready var muzzle = $Muzzle

Godot version 4.0
in Engine by (19 points)

Where did you write this? Show the rest of the script.

Here is the script: https://pastebin.com/UANXnwUH

I don't see any problem with that script. Indeed, if I paste it into Godot, it shows no errors.

I get an error on line 6. Could it be the version?

1 Answer

+1 vote
Best answer

I just saw that you're using 4.0. You do realize that 4.0 is not even alpha stage yet?

You should only be using 4.0 if you are a developer who is working on it, or if you are testing and helping to find bugs/issues for those developers. Many things don't work right now, and many others have changed from 3.x in ways that are not yet documented.

If you want to try and help with 4.0, you will need to follow the issues and discussions on Github, where you will find what has been changed. For example, GDScript has been changed a great deal, including many keywords becoming annotations, such as onready. Some of the changes are summarized here:

https://github.com/godotengine/godot/pull/39093

Again, I can't recommend this more strongly: If you're a beginner, you should not be using 4.0.

by (20,677 points)
selected by
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.