New to coding, need some help...

I can’t seem to figure out why this won’t work.

This is the error code

InvalidCastException: Cannot cast from source type to destination type.
UnityEngine.Object.Instantiate[Rigidbody] (UnityEngine.Rigidbody original, Vector3 position, Quaternion rotation) (at C:/buildslave/unity/build/Runtime/Export/UnityEngineObject.cs:207)
ThrowPortal.Update () (at Assets/Scripts/ThrowPortal.cs:25)`using System.Collections;

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class ThrowPortal : MonoBehaviour {

	public GameObject RightPortal;
	public GameObject mainCamera;
	public Rigidbody fun; 
	public GameObject Shooter;
	public Transform Spawn;

	// Use this for initialization
	void Start () {
	// Update is called once per frame
	void Update () {

		if (Input.GetMouseButton (0)) {
			Rigidbody Fun1;
			Fun1 = Instantiate (fun, Spawn.position, Spawn.rotation)as Rigidbody;
			Fun1.AddForce (Spawn.forward * 5000);

		if (Input.GetMouseButton (1)) {
			throwPortal (RightPortal);


	void throwPortal(GameObject portal){
		int x = Screen.width / 2;
		int y = Screen.height / 2;

		Ray ray = Camera.main.ScreenPointToRay (new Vector3 (x, y));
		RaycastHit hit;
		if (Physics.Raycast(ray, out hit)) {
			Quaternion hitObjectRotation = Quaternion.LookRotation (hit.normal);
			portal.transform.position = hit.point;
			portal.transform.rotation = hitObjectRotation;

Instantiate() takes a Object as first parameter, but you’re passing a Rigidbody.

Use either:

Instantiate (fun.gameObject, Spawn.position, Spawn.rotation) as Rigidbody;

or, if you’re using the “fun” variable only for that purpose, it would be better to declare it as GameObject in the first place.