First off, indent your code properly:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Paddle : MonoBehaviour
{
public bool isPlayer1;
public float speed;
public rigidbody2D rb;
private float movement;
void Update()
{
{
if (isPlayer1)
{
movement = Input.GetAxisRaw("Vertical");
}
}
movement = Input.GetAxisRaw("Vertical2");
}
rb.velocity = new Vector2(rb.velocity.x, movement * speed);
}
It makes it a lot clearer to see what is actually happening!
And the first thing that is obvious is that there is a pair of redundant curly brackets in there:
void Update()
{
if (isPlayer1)
{
movement = Input.GetAxisRaw("Vertical");
}
movement = Input.GetAxisRaw("Vertical2");
}
The second thing that becomes obvious is that this line of code:
rb.velocity = new Vector2(rb.velocity.x, movement * speed);
Isn't inside any method.
That won't compile: you cannot execute code unless it is inside a method - there is no way to call it!
So start out by working out where that code should be, and your problems may start to go away...