For some reason The player can only jump when their not moving. And can only jump on a single level. How to fix.

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class PlayerMovment : MonoBehaviour {
    public float movementSpeed; 
    public Rigidbody2D rb;

    public float jumpForce = 3f;
    public Transform groundChecker;
    public LayerMask groundLayers;

    float mx;
    private void Update() {
        mx = Input.GetAxisRaw("Horizontal");
        if(Input.GetButtonDown("Jump") && IsGrounded()) {

    private void FixedUpdate() {
        Vector2 movement = new Vector2(mx * movementSpeed, rb.velocity.y);

        rb.velocity = movement;

    void Jump() {
        Vector2 movement = new Vector2(rb.velocity.x, jumpForce);

        rb.velocity = movement;
    private bool IsGrounded() {
        if(rb.velocity.y == 0f && rb.velocity.x >= 0f) {
            return true;  
        return false;

pay more attention to the basic codes. in the bool IsGrounded(), you’re checking both rb’s vertical and horizontal velocity. that is responsible for making the player being able to jump only when it’s moving. you probably missplaced the ‘rb.velocity.x >= 0f’ instead of the ground checker’s overlapping point.
you can do like this:

public bool isGroundCheckerColliding;

public void Update(){

 // other stuff

 isGroundCheckerColliding = Physics2D.OverlapPoint(groundChecker.position);


public bool IsGrounding(){

if(rb.velocity.y == 0 && isGroundCheckerColliding){

 return true;

} else return false;



actually, there’s thousands of better ways to get the same result, but with a fastest and smaller code, but i assume you’re a begginner, once this code is form Brackeys’ tutorials, so it’s good to understand what every piece of code does, so i recommend you to study the basics for yourself, not getting all from YT and asking everything in the forums. that’s how you’re going to really make something good from scratch.

i think i said everything i wanted to. try to do stuff by yourself. it’s really grateful when you make something good with no help.

that’s it. good bye! hope i helped ya.