Timescale loop logic

I’m trying to get my game speed to decrease exponentially when I click a button, but my crashes every time I attempt this. I’m guessing it’s an infinite loop, but I can’t spot the flaw in my logic. Could it be something else?

while (Time.timeScale > .01f)
{
    Time.timeScale = (float) Math.Exp(Time.timeScale * -0.001f);
}
Time.timeScale = 0f;

This is probably because Math.Exp(Time.timeScale * -0.001f) will give you approximately 0.999 all the time if you start with Time.timescale = 1 (try e^(-0.001 * 0.999) in a calculator). Time.timeScale /= Math.E might be what you’re looking for.

Do you want to create slow motion effect ? if yes then reduce Time scale ones not in while loop. if you to reduce speed of player use time.delta time not TimeScale time scale pause ur game not slow down it slow down speed of game not object speed