Pulse Works Studio

Parse Error: Cannot infer the type of "speed" variable because the value doesn't have a set type.

:= cannot infer a type when the right-hand side is untyped or Variant.

Cause

A := binding needs a hard type on the initializer. If speed is copied from an untyped variable, or from a function whose return type is not declared, the analyzer refuses to guess. Give the variable an explicit type, or type the value it is copied from.

Fix

var authored_speed: float = 180.0

func _ready() -> void:
	var speed: float = authored_speed
	print(speed)

Related

Godot Dev Tools is a Pulse Works Studio project. All error explainers.