So currently, hitting/holding Z teleports him back to where he started the level at, then he floats from there, no matter where hes at in the level, he always teleports back to that spot then he floats. He is supposed to be able to float no matter where his current position is in the level.
The Z key is not actually part of the start method, its in its own section
void Start()
{
rb = GetComponent<Rigidbody2D>();
//Set a starting velocity when our Game Starts (Set x to 1 for moving Right and -1 for moving Left)
Vector3 DefaultVelocity = new Vector3(1 * spead, 0, 0);
rb.velocity = DefaultVelocity;
moveDir = spead;
originalPos = new Vector3(gameObject.transform.position.x, gameObject.transform.position.y, gameObject.transform.position.z);
rend = GetComponent<Renderer>();
rend.enabled = true;
//THIS IS IN OUR FLOATING SECTION
tempPoisition = transform.position; //uses the transform in the object's inspector. position uses x, ys and z. to use the current position. so no matter where it starts, it will always be correct
//CODING THE Z KEY TO FLOAT
if ((Input.GetKey(KeyCode.RightArrow)) && isGrounded && Input.GetKey(KeyCode.Z))
{
tempPoisition.x += horizontalSpeed;
tempPoisition.y += verticalSpeed = Mathf.Sin(Time.realtimeSinceStartup * verticalSpeed) * amplitude;
transform.position = tempPoisition; //apply x and y to current position