what am i doing wrong??????

no matter what i do there is always a problem with the xpos and if then statements:

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

public class look : MonoBehaviour
{
public Vector3 offset;
public Transform playerpos;

// Update is called once per frame
void Update()
{
xpos = transform.localEulerAngles.x;
transform.localRotation = Quaternion.Euler(0, Input.mousePosition.x, 0);
transform.position = playerpos.position + offset + transform.forward;
transform.localRotation = Quaternion.Euler(Input.mousePosition.y * -1,Input.mousePosition.x,0);
if (transform.localRotation.x < -90)
{
transform.Rotate(xpos – -90 * -1,0,0);
}
}
}

Please use the code brackets so its easier in the future. Also what is the problem with the xpos and if then please provide details on your errors.

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

public class look : MonoBehaviour
{
public Vector3 offset;
public Transform playerpos;

// Update is called once per frame
void Update()
{
xpos = transform.localEulerAngles.x;
transform.localRotation = Quaternion.Euler(0, Input.mousePosition.x, 0);
transform.position = playerpos.position + offset + transform.forward;
transform.localRotation = Quaternion.Euler(Input.mousePosition.y * -1,Input.mousePosition.x,0);
if (transform.localRotation.x < -90)
{
 transform.Rotate(xpos -- -90 * -1,0,0);
}
}
}

Okay so you are saying if (transform.localRotation.x <-90) do transform.Rotate(xpos --90 *-1,0,0)

But you have no else statement.

What are you trying to do if it doesn’t = (transform.localRotation.x <-90)?

Edit: Am dumb can absolutely do If statements without else’s, tis what I get for responding before coffee.

One note, -90 * -1 is just 90.

I’m not familiar with this syntax

xPos – -90 * -1;

My best guess would be that this is equivalent to the following, probably not your intent.

xPos - 91