how to make a gun in a different scene than the player

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

I am trying to make an fps game, and I’m trying to add weapons, all the tutorials I have looked at tell me to make the gun in the same scene as the player but that does not work for me because I made a system to switch between weapons, and the weapons have to be in a different scene than the player, so I was wondering if anyone knows how to make a gun in a separate scene

thanks

:bust_in_silhouette: Reply From: IHate

Create a new scene and make the gun, save the scene and load it when you need it.
You can preload all the guns (“gun scenes”) when you start the scene with the player

var granade = preload("res://guns/granade")
var shotgun = preload("res://guns/shotgun")
...

and then show/hide/disable then as you need to.

To add a new scene you can click on the plus icon next to your current scene or at the top menu scene > new scene