So I have a script for a weapon that can shoot multiple bullets at once, but there’s always 1 bullet that stays at the same place, even if it’s only 1 bullet at a time.
Edit: I already removed the “S”, didn’t fix it
Here’s the script:
You are trying to grab the rigidbody of the bullet before you spawn it. Move line 25 where you grab the rigidbody of Bullet2 to right after the Instantiate() call so that it actually refers to the rigidbody of the spawned bullet. Instantiate makes an entirely new game object, so the rigidbody that you want doesn’t even exist until you call instantiate.
**
Also a note on lines 27 and 28… the x, y, and z values of a rotation aren’t angles. If you want to add a random angle to a rotation like you are trying to do, use rotation.eulerAngles.x, y, or z instead as these actually refer to the angles of rotation around each axis. The values that you see for x, y, z rotation in the inspector are actually these euler angles.