Replacing a rigid body with a game object...

Ive been searching for over an hour now guys, and i cant seem to figure out how to simply destroy a rigidbody (the bullet) and replace it with a gameObject (the bullet hole decal). I got this much code done and attached it to my bullet:

var destroyTime = 2.0;
var Decal = Transform;

function Update () {
	
	Destroy(gameObject, destroyTime);
}    
function OnCollisionEnter(collision : Collision) {
    
	Destroy(gameObject);
	Instantiate (Decal);
}

But it keeps giving me an error on the Instantiate part: Assets/BulletDespawn.js(13,21): BCE0023: No appropriate version of ‘UnityEngine.Object.Instantiate’ for the argument list ‘(System.Type)’ was found.

…Any help would be greatly appreciated!

P.S. this is a repost… but i posted it in the wrong section last time… sorry :frowning:

You’re assigning the class Transform to the variable instead of assigning an actual Transform, which is why you’re getting the error that Instantiate is choking with a System.Type passed to it (you can see in the Scripting Reference that Instantiate wants a Unity Object or subclass of Object). You probably intended this:

var Decal:Transform;

and then you can drag/assign that GameObject to the variable in the Inspector.

but since you’re talking about instantiating a GameObject, perhaps it would be more clear to have

var Decal:GameObject;

so the code is referring to the GameObject directly and not the Transform of the GameObject (but it should work the same either way, as the doc notes)