+2 votes

Hey everybody, I'm trying to spawn a bullet upon clicking the mouse. The problem is the bullet is spawned once and after that the engine doesnt instantiate more with the error "Can't add chil, already has parent".

Here is the code that instantiates the bullet scene:enter image description here

and here is the scene it is being called to: Right Gun is whats callid the shooting script

What am i doing wrong, I've followed the simple shooter sample project?

in Engine by (37 points)
edited by

1 Answer

+3 votes
Best answer

[FIXED] Had to use instance the in add_child() so the code became:

var bullet = preload("blal")

func shoot():
by (37 points)
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.