This site is currently in read-only mode during migration to a new platform.
You cannot post questions, answers or comments, as they would be lost during the migration otherwise.
0 votes

Im using the script to display my model

var currentplayerOne = PlayerSelectionManager.playerOne.instance() 
    Globals.playerOne.global_transform = playerOne.position = Vector2(1.391, 0.718, -1.482).global_transform

What causes this error?
- Parse Error: Unexpected assign.

Godot version 4.3
in Engine by (104 points)

if you could take a screenshot showing the error code line it would be easier to know what the problem is.

1 Answer

0 votes
Globals.playerOne.global_transform = playerOne.position = Vector2(1.391, 0.718, -1.482).global_transform

This C/C++ style assign is not tolerated in GDScript.
Vector2's have no such property as global_transform.

Globals.playerOne.global_transform = Vector3(1.391, 0.718, -1.482)
playerOne.position = Vector3(1.391, 0.718, -1.482)


Globals.playerOne.global_transform = Vector3(1.391, 0.718, -1.482)
playerOne.position = Globals.playerOne.global_transform
by (6,942 points)
edited by

Also, Vector2(1.391, 0.718, -1.482) won't work. Use Vector3(1.391, 0.718, -1.482), or eliminate a dimension, whichever is appropriate for the circumstances.

Wow didn't even notice. Just copypasta.

Looks like the new property position on Spatial correction Node3D is already causing confusions.

One of the reasons why it's important to always use functions to assign vars and not directly with globals everywhere

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 Frequently asked questions and 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 [email protected] with your username.