I want to flip my gun when gun rotation in less than 90 but more than -90 .PLS help me

using System;
using System.Collections;
using System.Collections.Generic;
using Unity.Mathematics;
using UnityEditor;
using UnityEditor.Experimental.GraphView;
using UnityEngine;
using UnityEngine.UIElements;

public class GunRotator : MonoBehaviour
{
[SerializeField] private GameObject gun;
private void Update()
{
Vector3 localScale = new Vector3(1,1,1);
if (transform.rotation.eulerAngles.z > 90 && transform.rotation.eulerAngles.z < -90)
{
localScale.y = -1;
}
else {
localScale.y = 1;
}
}
}

Don’t use eulerAngles, generally speaking.

Instead, check the x value of a vector off the gun transform, something like:

if (gunTransform.right.x > 0)
{
  // gun facing right
}
else
{
  // gun facing left
}

Here’s why we stay away from euler angles:

All about Euler angles and rotations, by StarManta:

https://starmanta.gitbooks.io/unitytipsredux/content/second-question.html

looking at your code this localScale variable you have created is not applied to anything. In your code you can access the gun scale using

gun.transform.localScale