Im trying to make it so when W is pressed my sprite roates 15 degrees but doesnt continue rotating while w is pressed it just rotates once.

public class Movment : MonoBehaviour
{
public float speed;
bool isPressed;

public void TogglePressed(bool value)
{
    isPressed = value;
}

private Rigidbody2D rb2d;

void Start()
{

    rb2d = GetComponent<Rigidbody2D>();
}

void FixedUpdate()
{
   
    float moveHorizontal = Input.GetAxis ("Horizontal");

    float moveVertical = Input.GetAxis ("Vertical");


    Vector2 movement = new Vector2 (moveHorizontal, moveVertical);

    
    rb2d.AddForce (movement * speed);

}

}

I didn’t understood your question properly so I can be wrong…I Think You Should Try This…

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

class WhatEverYourScriptNameis : Monobehaviour
{
  Rigidbody2D player;  // making a reference for the player
  public Vector2 rotation = (0f, 15f); // this will rotate the player according to your given values
  public float RotationSpeed = 15f; // the speed at which the object will rotate
  
  void Start()
 {
   player = GetComponent<Rigidbody2D>();
 }
 void Update()
 {
   if (Input.GetKey(KeyCode.W)) // Input.GetKey makes it so that the player will rotate the long you press a certain key (W) and not just one time
  {
    player.transform.Rotate(rotation * RotationSpeed * Time.deltaTime);
  }

 }
  
}