NullReference exception() even when i have everything linked in the hierarchy

Player Movement Script:

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

public class PM : MonoBehaviour
{
    private float horizontal;
    private float jumpingPower = 24f;
    private bool isFacingRight = true;



    private bool IsShimmered;
    private bool ShimmerSpam;

     private Vector3 respawnPoint;
    public GameObject FallDetector;
    public static Rigidbody2D rb;
    [SerializeField] private Transform groundCheck;
    [SerializeField] private LayerMask groundLayer;
    [SerializeField] private TrailRenderer tr;
    [SerializeField] private float speed = 7f;

    private void Start()
    {
        respawnPoint = transform.position;
    }

    private void Update()
    {
   
        horizontal = Input.GetAxisRaw("Horizontal");

        if (Input.GetButtonDown("Jump") && IsGrounded())
        {
            rb.velocity = new Vector2(rb.velocity.x, jumpingPower);
        }

        if (Input.GetButtonUp("Jump") && rb.velocity.y > 0f)
        {
            rb.velocity = new Vector2(rb.velocity.x, rb.velocity.y * 0.5f);
        }

        Flip();
    }

    private bool IsGrounded()
    {
        return Physics2D.OverlapCircle(groundCheck.position, 0.2f, groundLayer);
    }
//HERE IS WHERE THE SUPPOSED ERROR IS
     private void FixedUpdate()
    {
        rb.velocity = new Vector2(horizontal * speed, rb.velocity.y);
    }

    private void Flip()
    {
        if (isFacingRight && horizontal < 0f || !isFacingRight && horizontal > 0f)
        {
            Vector3 localScale = transform.localScale;
            isFacingRight = !isFacingRight;
            localScale.x *= -1f;
            transform.localScale = localScale;
        }
    }


  private void OnTriggerEnter2D(Collider2D collision)
  {
    if(collision.tag == "FallDetector")
    {
        transform.position = respawnPoint;
       
    }

    if(collision.tag == "CheckPoint")
    {
        respawnPoint = transform.position;
    }
  }
}

The script that enables low gravity zones:

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

public class Shimmeur : MonoBehaviour
{
    private GameObject player;


    public PM script;
    void Start()
    {
        player = GameObject.FindGameObjectWithTag("Player");
    }

        private void OnTriggerEnter2D(Collider2D collision)
        {
            if (collision.tag == "Player")
            {
                PM.rb.gravityScale = 0.5f;
            }

            else
            {
                PM.rb.gravityScale = 3f;
            }
        }
}

I do know that this question has already been posted several times but after searching for a while i never found the answer i need,any ideas?

Absolutely nothing above tells me you have done the three steps.

I’ll post them again for you.

How to fix a NullReferenceException error

https://forum.unity.com/threads/how-to-fix-a-nullreferenceexception-error.1230297/

Three steps to success:

  • Identify what is null ← any other action taken before this step is WASTED TIME
  • Identify why it is null
  • Fix that

thats the thing i KNOW what is failing ( it did work before i made the shimmeur script) but i dont know how to fix it

That’s not step #1.

Step #1 is identify what is null.

What is null? You still haven’t said and yet you expect someone here to figure it out!

Again, three steps. It’s not hard.

How to fix a NullReferenceException error

https://forum.unity.com/threads/how-to-fix-a-nullreferenceexception-error.1230297/

Three steps to success:

  • Identify what is null ← any other action taken before this step is WASTED TIME
  • Identify why it is null
  • Fix that

ALSO: why is line 18 static? That’s unnecessary. Access it via normal instance references, like so:

Referencing variables, fields, methods (anything non-static) in other script instances:

https://discussions.unity.com/t/833085/2

https://discussions.unity.com/t/839310

REMEMBER: it isn’t always the best idea for everything to access everything else all over the place. For instance, it is BAD for the player to reach into an enemy and reduce his health.

Instead there should be a function you call on the enemy to reduce his health. All the same rules apply for the above steps: the function must be public AND you need a reference to the class instance.

That way the enemy (and only the enemy) has code to reduce his health and simultaneously do anything else, such as kill him or make him reel from the impact, and all that code is centralized in one place.

Your rigidbody is static for some reason and you assign nothing to it. Of course it will be null.

Don’t make it static. Remove that, so it can be serialised in the inspector, and assign it.

Then, in your Shimmeur script, get the rigidbody with GetComponent off of the collider, and then do what you need with it.

I am sorry for my past actions i was pretty frustated,sorry,spiney i will try your advice,ill update you if anything happens,thanks btw