How can I parent the player to another GameObject (Vehicle)?

Hi,
I’m working on a game, where one of the mechanics, is that you can ride on the back of a truck.

And yes, I’m aware, I’m sure this question has been asked a million times before, but I feel like I’ve looked at / tried everything, and I cannot seem to be able to get / find / get anything that works.

In order to achieve this, I imagined making the player be parented to the truck, and the truck would be able to move around, moving the player around with it. I looked it up, and found a script, and tried it. It would not work. Instead, it would warp the character / player, flattening the character, and widening the character. The character would somewhat move, but would mainly get stretched and distorted, and if I drove off the platform, the character would get stretched along the y / height axis, up into the air / sky, then skew (or maybe rotate, I can’t tell, entirely, sorry,), towards the vehicle.

Here is my current script:
using UnityEngine;
using System.Collections;

public class RideTruck : MonoBehaviour
{
	bool guiShow = false;
	bool isRiding = false;

	public GameObject handle;
	public GameObject player;
	public GameObject truck;
	public GameObject truckparent;

	public int rayLength = 2;

	void Update()
	{
		RaycastHit hit;
		Vector3 fwd = transform.TransformDirection(Vector3.forward);

		if (Physics.Raycast(transform.position, fwd, out hit, rayLength))
		{
			guiShow = true;
			if (Input.GetKeyDown("e") && isRiding == false)
			{
				isRiding = true;
				guiShow = false;
				truckparent.transform.parent = truck.transform;
				player.transform.parent = truckparent.transform;
			}
			else if (Input.GetKeyDown("e") && isRiding == true)
			{
				isRiding = false;
				guiShow = false;
				transform.parent = null;
			}
		}
		else
		{
			guiShow = false;
		}
	}
	void OnGUI()
	{
		if (guiShow == true && isRiding == false)
		{
			GUI.Box(new Rect(Screen.width / 2, Screen.height / 2, 100, 25), "Ride Truck");
		}
		else if (guiShow == true && isRiding == true)
		{
			GUI.Box(new Rect(Screen.width / 2, Screen.height / 2, 100, 25), "Stop Riding");
		}
	}
}

Also, the character will either distort, or not move at all. As of right now, what it seems to be doing, is no matter what, it won’t move. It sometimes will distort, but it never seems to move anymore now.

transform.parent = gameObjectYouWantAsParent.transform;
or

transform.parent = transformYouWantAsParent;

on player script

If you do not want the player to squish, then the parent needs to be of scale 1, 1, 1.
If the parent is not of scale 1, 1, 1, then you need to use a custom parenting system to apply any translations and rotations that the parent has to the player. There are many of these online.

Here is your solution with a proper explanation. Always try to maintain (1,1,1) scale.