Need help with the if statement inside my code

Godot Version

V4.3-stable

Question

Im new to godot and need help with my code. There’s an error code saying “Assignment is not allowed inside an expression.” I have a script named “Global” that is in the global setting in project settings

extends Node
var Scene = preload(“res://Scenes/Bankrupt.tscn”)

func _process(delta: float) → void:
If Global.money = 0:
get_tree().change_scene_to_file(“res://Scenes/Bankrupt.tscn”)

Global.money == 0

double =
= - assign
== - compare to be exact same

3 Likes

Thanks, i was wondering what assignment meant in the error message.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.