Stop Movement only if .....

I already made it so when u push ctrl it stops all movement
by puting key down (ctrl)- script editor and i put
yvelocity = yvelocity = 0;
xvelocity = xvelocity = 0;
and it makes it stop, but how to you make it so you only can
make it stop when it is toughting ( coliding repidetly )
the ground or platform
Thanks ahead of time.

yvelocity = yvelocity = 0;
xvelocity = xvelocity = 0;
and it makes it stop, but how to you make it so you only can
make it stop when it is toughting ( coliding repidetly )
the ground or platform



Thanks ahead of time.
