Invalid operands 'Array' and 'int' in operator '==' float registered as array

Godot Version



I have written some code to load save data from a save file. I cannot work out why but Godot seems to think that the variable level is an array when it is a float. How can I fix this?

extends Node

Set up variables

Array of which clues have already been found

var foundClues =
var current_room = “null”
var level = 0.0

The target save path for the save file

var save_path = “C:/Users/ezrac/OneDrive/Documents/P.I. Noire/Save Data/”

Whether data is trying to be retrieved where it cannot be found.

var missingData = false

var axePrevious = false
var notePrevious = false
var personPrevious = false
var receiptPrevious = false

Save the game

func save():
var file =, FileAccess.WRITE)
# Store the variables there

Load a previous save

func load_data():
# If there is a save file at the save location
if FileAccess.file_exists(save_path):
var file =, FileAccess.READ)
level = file.get_var(level)
if level == 1:
foundClues = file.get_var(foundClues)
if “Axe” in foundClues:
axePrevious = true
if “Note” in foundClues:
notePrevious = true
if “Person” in foundClues:
personPrevious = true
if “Receipt” in foundClues:
receiptPrevious = true
elif level == 1.5:
# Show data as missing
missingData = true

func update_clues(clue):

Clear existing save data

func clear_data():
# Write to the file
var file =, FileAccess.WRITE)
# Overwrite the save data to original states
foundClues =
level = 0
# Store save data in the save file

first time i see a level can be a float and you check it by 1.5 of it
try specify the level variable as a float early on:


var level:float = 0.0
1 Like