Make code execute for a specified time?

Once i click a cube in my game i wish for the timescale to be half, therefore halfing the games time, the problem is how do i do this for say 5 seconds? Is there any way of possibly keeping it in the slowed state for 5 seconds?

Im new to unity so thanks!

Check out coroutines. You can use ‘WaitForSeconds()’ to do this fairly easily.