I'm getting a Parser Error: ":" expected -- and, of course, there's one there

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By dondudding

I’m still very new to this. In fact, I am working through a basic tutorial and as far as I can tell, I typed in the script verbatim from the tutorial video. I keep getting an error that says “Parser Error: ‘:’ expected at end of line” and there’s one there. If anyone could look at this script below (it’s a basic platform player controller) and tell me where I’m screwing up, it would be much appreciated. I’ve got some great ideas for using Godot if I can just get past these early snafus. Thanks.

extends KinematicBody2D

const UP = Vector2(0,-1)
const GRAVITY = 20
const SPEED = 200
const JUMP_HEIGHT = -850

var motion = Vector2()

func _physics_process(delta):
motion.y += GRAVITY

if Input.is_action_pressed("ui_right"):
	motion.x = SPEED
else Input.is_action_pressed("ui_left"):
	motion.x = -SPEED
else:
	motion.x = 0

if is_on_floor():
if Input.is_action_pressed(“ui_up”):
motion.y = JUMP_HEIGHT
motion = move_and_slide(motion, UP)
pass

The error message is focused on the first else statement
else Input.is_action_pressed(“ui_left”):

:bust_in_silhouette: Reply From: kidscancode

The : is expected right after else. You can’t have any other statement with else.

It looks like you may want an elif there, since you’re testing another condition. elif stands for else if.