Slider.value won't change to INT

void Update () {
slider.wholeNumbers = true;
}

public void Test(){
		WeaponsIndex = slider.value;
	}

This is where my problem is residing in my code. I’m getting a
Cannot implicitly convert type float' to int’. An explicit conversion exists (are you missing a cast?)
No matter what I do. I figured changes in the code in update that whole numbers would be true would solve it however slider.value is still a float instead of int.

If “WeaponsIndex” is an int variable, cast the float value of the slider to an int.

WeaponsIndex = (float)slider.value;

The “wholeNumbers” property doesn’t change the float type of the value to an int, it just prevents the slider to move into non-integer values when moving it.