Need Help Fixing The Error: Syntax Error, ',' Expected.

Can You Guys Help me with this error in my code below? Because I can’t get rid of this error, Also I can’t Get rid of it because I’m a starter to C#.

My Code:

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

public class PlayerMovement : MonoBehaviour;
{
   public RigidBody rb;

   public float ForwardForce = 2000f;
   public float BackwardsForce = -2000f;
   public float JumpForce = 1000f;
    // Update is called once per frame
    void Update ()
    {


      if ( Input.GetKey("right") )
     {
        rb.AddForce(ForwardForce * Time.deltaTime, 0, 0);
     }

      if ( Input.GetKey("left") )
     {
        rb.AddForce(BackwardsForce * Time.deltaTime, 0, 0);
     }

      if ( Input.GetKey("vbKeySpace") )
     {
        rb.AddForce(0, JumpForce * Time.deltaTime, 0);
     }
   }
}

I hope you can do something about this.

Good luck!

We hope you can too.

If you post a code snippet, ALWAYS USE CODE TAGS:

How to use code tags: https://discussions.unity.com/t/481379

How to understand compiler and other errors and even fix them yourself:

https://discussions.unity.com/t/824586/8

How to report your problem productively in the Unity3D forums:

http://plbm.com/?p=220

Thanks But where exactly do i add the comma?

What does the error message tell you?

In this case it just draws your attention to line 5… the problem is you have added a semicolon at the end of that line. Remove it.

ALSO:

  • do physics stuff inside of FixedUpdate() or else your apps behavior will change with framerate changes

  • do not use Time.deltaTime when giving forces, for the same reason.

All the above is in the docs for the Unity physics system. You probably want to start with some existing physics example codes so you can get a feel for how things work.

Thanks a lot. But I have a new error