You are trying it way too complicated

Simply use SetRange(0, 5) for example which will give you 6 ticks and the slider will jump between those 6 ticks.