help please

I am new to c sharp and am following a tutorial but I am getting 4 errors that I cant understand from what is see the code looks the same but mine isn’t working.

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

public class playerMovement : MonoBehaviour
{
    Rigidbody rb;
    [SerializeField] float movementSpeed = 6f;
    [SerializeField] float jumpForce = 5f;

    [SerializeField] Transform groundCheck; // problem was triggered when putting in this line and one further down

    // Start is called before the first frame update
    void Start()
    {
        rb = GetComponent<Rigidbody>();
    }

    // Update is called once per frame
    void Update()
    {
        float horizontalInput = Input.GetAxis("Horizontal");
        float verticalInput = Input.GetAxis("Vertical");

        rb.velocity = new Vector3(horizontalInput * movementSpeed, rb.velocity.y, verticalInput * movementSpeed);

        if (Input.GetButtonDown("Jump"))
        {
            rb.velocity = new Vector3(rb.velocity.x, jumpForce, rb.velocity.z);
        }
    }

     bool IsGrounded() // this part also triggered the errors
    {
        return true; 
    }
}
  • Edited by wideeyenow_unity : reason : Duplicated text

Not exactly sure, as I’ve never seen this error before? But it’s basically saying you have duplicate scripts. So double check your assets folders and make sure there isn’t already a PlayerMovement.cs somewhere.

Since the class name is pretty common, you might have an downloaded asset that already has a class of this name within your project. I would copy the script, and paste it into a new script, with a more unique name. See if that doesn’t fix it.

put code and images in twice for some reason sry