Hello!
I am trying to make a script spawn a prefab whenever the player presses space, facing the direction of the player. The object will then move in the direction of where the player was facing, at a speed of 10. This is the only working code I can figure out, every time I try making the object, which is not what the script is attached to, move, I get an error.
If anyone could show me what could work and why I would be extremely grateful! Thanks!
if (Input.GetKey(KeyCode.Space)) {
Instantiate(LasarBeam, transform.position, transform.rotation);
}