Gavity on player

hi im trying to make my ai companion control the gravity of my main character on press of a button and the overlap of a box it works but some times it dose not work dose any one know why help would be much appreciated the problem is that sometimes the character dose not com back down