im trying to make a firing system

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By theMX89

hi guy’s, im trying to make a firing system in gdscript following the tutorial on this website:
https://kidscancode.org/godot_recipes/3d/3d_shooting/

but theres an error in one
row:

func _process(delta):
move_and_collide(Vector3.DOWN * fallingSpeed * delta)
if Input.is_action_pressed(“ui_up”):
move_and_collide(transform.basis.x * moveSpeed * delta)
if Input.is_action_pressed(“ui_left”):
rotate(Vector3.UP, +rotatingSpeed * delta)
if Input.is_action_pressed(“ui_right”):
rotate(Vector3.UP, -rotatingSpeed * delta)

if Input.is_action_just_pressed("ui_accept"):
var b = Bullet.instance()                 <------ error
owner.add_child(b)
b.transform = $Cannon/Muzzle.global_transform
b.velocity = -b.transform.basis.z * b.muzzle_velocity

pass

this script is in the player

What does the error message say?

DiMiMi | 2021-06-05 14:33

:bust_in_silhouette: Reply From: Help me please

your code should be like this

	if Input.is_action_just_pressed("ui_accept"):
        var b = Bullet.instance() 
        owner.add_child(b)
        b.transform = $Cannon/Muzzle.global_transform
        b.velocity = -b.transform.basis.z * b.muzzle_velocity

because the if statement always go like this

if some_condition:
    code goes here
 
:bust_in_silhouette: Reply From: theMX89

ok ,thanks .
it works