transform.eulerAngles is always setting rotation to 90 degrees from a variable

I am using the code below to rotate something, however it only rotates the object to 90 degrees even though the angle changes from 0-90 in the debug log. If I switch the variable currentvalue to an actual integer like 45 then it will rotate correctly, does anyone know why this might be happening?

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

public class RopeRotation2 : MonoBehaviour
{
public GameObject object7;
public Slider_Script barangle;
private float currentvalue;
// Start is called before the first frame update
void Start()
{

}
// Update is called once per frame
void Update()
{
currentvalue = barangle.value;
object7.transform.eulerAngles = new Vector3(object7.transform.eulerAngles.x, object7.transform.eulerAngles.y, currentvalue);
Debug.Log(currentvalue);
}
}

All about Euler angles and rotations, by StarManta:

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

Notes on clamping camera rotation and NOT using .eulerAngles because of gimbal lock:

How to instantly see gimbal lock for yourself:

Also for future reference, if you post a code snippet, ALWAYS USE CODE TAGS:

How to use code tags: Using code tags properly