call function when press ui button

i have this script in java script i add it to my game object and add the game object to a new function in the button list. my problem is that when i press play i can move the gameobject with the left ctrl button in keyboard but the button appear can’t do anything. i select the update function from the list but nothing happen. how can i call this funcxtion to move my game object with the new ui system in unity

function Update () {
// Maincode flying ----------------------------------------------------------------------------------------------------------------------------------

	// M Code is active when varwhatmoves is 1

	//  Speed

		if ((groundtrigger.triggered==1)&&(Input.GetButton("Fire1"))&&(speed<800)) speed+=Time.deltaTime*240;				


If I am reading your question correctly, it sounds like you shouldn’t be using Update directly from the UI. You should have a function (let’s call it function Move() ) that does what you want it to do. Strictly speaking, Update isn’t a function, it’s more like an event listener (do this on every frame).