Pulse Works Studio

Parse Error: Cannot get return value of call to "move_and_slide()" because it returns "void".

move_and_slide() no longer returns the leftover velocity. The call returns void.

Cause

Godot 3 returned the remaining motion from move_and_slide. Godot 4 reads and writes the velocity property and returns nothing. Assigning that call, or passing it to another function, is the error.

Fix

extends CharacterBody2D

func _physics_process(delta: float) -> void:
	velocity.y += 980.0 * delta
	velocity.x = Input.get_axis("ui_left", "ui_right") * 220.0
	move_and_slide()
	if is_on_floor() and Input.is_action_just_pressed("ui_accept"):
		velocity.y = -320.0

Related

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