Help with script

I am trying to make a script when the player clicks a gameobject then by hiting certain keys can move it around
But I cant figure it out so far I have:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class EditScript : MonoBehaviour {

public float x;
public float y;
public bool z;
public bool b;
public Rigidbody r;
void Start () {
r = GetComponent ();
}
void OnCollisionStay(Collision collision) {
if (collision.gameObject.tag == “Player”) {
b = true;
Debug.Log (“Edit();”);

x = Input.GetAxis (“Horizontal”);
y = Input.GetAxis (“Vertical”);
z = Input.GetKeyDown (KeyCode.R);
if (x > 0) {
r.AddRelativeForce (1f, 0f, 0f);
x = 0f;
}
if (y > 0) {
r.AddRelativeForce (1f, 0f, 0f);
}
if (z) {
r.AddRelativeForce (Vector3.forward);
if (!z) {
z = Input.GetKeyDown (KeyCode.C);
if (z) {

}
}
}

}
}
}
It would be helpful if you have a working script

Have you done some tutorials? Learn

For future reference, please post your code using code tags. You can look at this thread for how to do that: Using code tags properly

I really think you should try the learn section for introduction to Unity, scripting, and some basic games maybe.
I’m not sure that trying to guide you, from your current script, would be helpful.

Some points, though:

  1. selecting an object
  2. reading input and performing actions based on it, using the selected game object
  3. Read singular input in Update(). Sometimes you want to execute it in Update, also, and sometimes you want to delay the execution until FixedUpdate.
  4. Held keys/axis is okay to read in FixedUpdate (or physics callbacks, such as on collision stay)

Tried to break down some goals & ideas for you.