I have a problem with my movement script

Hello,
I’m starting to write scripts in C#, but I have a little problem with my code because I get this error:

Assets\Scenes\movment2.cs(15,27): error CS1002: ; expected

And this is my code:

using UnityEngine;


public class PlayerMovement : MonoBehaviour
{
    public float moveSpeed = 5f;
    public float jumpForce = 5f;


    Rigidbody rb;


    void Start()
    {
        rb = GetComponent global::System.Object value = Rigidbody();
    }


    void Update()
    {
        float moveX = Input.GetAxis("Horizontal");
        float moveZ = Input.GetAxis("Vertical");


        Vector3 movement = new Vector3(moveX, 0f, moveZ);

        rb.AddForce(movement * moveSpeed);


        if (Input.GetKeyDown(KeyCode.Space));
        {
            rb.AddForce(Vector3.up * jumpForce, ForceMode.Impulse);
        }
    }
}

Can anyone help me solve my problem?

Line 15

rb = GetComponent global::System.Object value = Rigidbody();

should be

rb = GetComponent<Rigidbody>();
1 Like

My script works now,
thanks for your help

1 Like