My problem with my gun so far is the bullet. I know i need it to go out a distance and then go back to the gun, but doing that, is over my head. here is the code i saw and put on my bullet: using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class bulletscript : MonoBehaviour {
var Bullet : Transform;
var Spawn : Transform;
function Update ()
{
if(Input.GetButtonDown("Fire1"))
{
Shoot();
}
}
function Shot()
{
var pel = Instantiate(Bullet, Spawn.position, Spawn.rotation);
pel.rigidbody.AddForce(transform.forward * 8000);
}}
so the error it gives it the :'s in the beginning of the code, and I tried using ='s but I have no idea what i am doing. anyway, thanks!