How do i transform my cube player with a press of a button

Hello, before i go any further I’m trying to learn coding on my own and I’m bad at it. I’v been wondering how do i make my player change its size by pressing ‘F’ to be smaller. To explain my problem little easier my game is about a cube player that is able to change into a smaller cube to fit in small areas to get further into the map How do i do this??

==============================================================

I want my cube player to be able to press ‘F’ and change into a smaller cube
and to press ‘F’ back into its original shape

==============================================================

-Adrian

You need Transform.localScale and Input.GetKeyDown. I don’t really know how far you are along, and since you are trying to learn on your own here is some sudo code for shrinking the player:

float scaleFactor
bool shrunk

if (Input && not shrunk)
     shrunk = true
     scale *= scaleFactor

I know you’ll probably be a little dissatisfied with this answer, but I truly believe that the best way to learn is by making mistakes, and figuring things out on your own. Learning to code on your own isn’t easy, and I wish you luck on your journey. If you have any questions, feel free to ask them.

Im so confused but thanks anyway…