# help with my script

Attention Topic was automatically imported from the old Question2Answer platform.
Old Version Published before Godot 3 was released.

**I am getting this error:**Invalid call. Nonexistent function ‘move_and_slide’ in base ‘KinematicBody2D (KinematicBody2D.gd)’.

I don’t know why… I am following a tutorial and it is LITERALLY the exact same and he didn’t get an error. Can you tell me what’s wrong with my script and how to fix it? Here’s the link to the video https://www.youtube.com/watch?v=Viaslrr1Md4

Here’s my script:

``````extends KinematicBody2D
``````

#Laws of Physics
const GRAVITY = Vector2(0, 500)

#Movement Contants
const FLOOR_NORMAL = Vector2(0, -1)
const SLOPE_FRICTION = 28
const MOVEMENT_SPEED = 400
const ACCELERATION = 1
const JUMP_FORCE = 200

#Player Variables
var velocity = Vector2()
var can_jump = false

#Start
set_fixed_process(true)

#Processing
func _fixed_process(delta):
velocity += GRAVITY * delta

``````#old:
#move(velocity)

#new:
#Move and Slide
velocity = move_and_slide(velocity, FLOOR_NORMAL, SLOPE_FRICTION)
# Movement
var movement = 0

if(Input.is_action_pressed("ui_left")):
movement -= 1
``````
``````if(Input.is_action_pressed("ui_left")):
movement += 1

movement *= MOVEMENT_SPEED

# Change horizontal veloctiy
velocity.x = lerp(velocity.x, movement, ACCELERATION)

#Input: Jump
if(can_jump && Input.is_action_pressed("ui_up")):
velocity.y -= JUMP_FORCE
can_jump = false
``````

Okay.

1. What version are you using? The latest stable release is 2.1.3, and
he is using an alpha build for 2.2. Where did you get the function
for `move_and_slide`? This Function does not exist in Godot (At least
the 2.1.3 stable). (Hence the Nonexistent function part.)

From what I can tell, you are using the wrong version. Of Godot.
Here’s what the man in the tutorial recommend using. WARNING IT’S IN
ALPHA! Unofficial Godot Engine builds - Hugo Locurcio

2. If you wish to use Godot 2.1.3 Then use the `move()` function and if
your character sticks to stuff use `is_colliding()` and
`get_collision_normal` to slide your character.

Here’s an example /It’s from one of my projects so it probably doesn’t work with your code./:

``````#MovePlayer
var motion = velocity * delta
move(motion)
#Slide player if colliding
if is_colliding():
normal = get_collision_normal()
motion = normal.slide(motion)
velocity = normal.slide(velocity)
move(motion)
``````