input key is always pressed

I tried with several keys and they all work as if they were always pressed :frowning:

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

public class Porta1A2 : MonoBehaviour
{
    public bool open;
    public GameObject rotate;

    void Start()
    {
        open = false;
    }

 
    void Update()
    {
        if (Input.GetKey(KeyCode.F));
        {
            Debug.Log("presss");
            open = true;

        }
        if (open == true)
        {

            transform.localRotation = Quaternion.Lerp(transform.localRotation, rotate.transform.localRotation, 2);
        }
    }

}

Lol =) Why You don`t set your “open” variable to the false when the key F is unpressed? In Update You only set it to the true.

sttil not working… it’s like the key is always pressed, even if I press it, it doesn’t stop

Show me your new code.
You need something like this:

if (Input.GetKey(KeyCode.F))
{
Debug.Log(“presss”);
open = true;
}
else
open = false;

Or more better replace whole code above on this :

open = Input.GetKey(KeyCode.F);
Debug.Log($“press={open}”);

And in your code one place is very suspiciously:

if (Input.GetKey(KeyCode.F)); <— delete this semicolon

omg that worked tanks, but now i can´t use esc key XD the key it´s not broke in my keyboard but it´s not woking in unity…

if (Input.GetKeyDown(KeyCode.Escape))
{
MenuEsc = true;
}
if(MenuEsc == false)
{
onibus.GetComponent().enabled = true;
escMenu.SetActive(false);
}
if (Input.GetKeyDown(KeyCode.Escape))
{
MenuEsc = false;
}
if(MenuEsc == true)
{
onibus.GetComponent().enabled = false;
escMenu.SetActive(true);

That`s all you need:

MenuEsc = Input.GetKeyDown(KeyCode.Escape);
onibus.GetComponent().enabled = !MenuEsc;
escMenu.SetActive(MenuEsc);