Pong AI paddle question

Hello, I've been working on making a Pong game, I have the player paddle and the ball working, but I cannot figure out what I should do to get the AI paddle to work.

What I want to do is have it move up if the ball is above it and down if the ball is below it, that would be easy but I do not know what I have to do to find out what position the ball is on in the Y axis. Could anyone please tell me what function finds out what an objects Y position is? am I able to use transform.Position to find the position of an objects Y axis if the script is not attached to that object?

First you need to find your ball. You could de fine it as a class variable, or add a script to it called "PingPongBall" and find it like this:

C#:

Transform myball;
myBall = ((PingPongBall) (FindObjectOfType(typeof(PingPongBall))) as PingPongBall).transform;//We find a ball *script* then select its transform

js:

var myBall : Transform;
myBall = (FindObjectOfType(PingPongBall) as PingPongBall).transform;//We find a ball *script* then select its transform

Then, you can simply call:

myBall.position.y

to get its y position. :)