Event Listener Cloning with Instance Issue

I am working on a gun system for my upcoming game and I need to use the AncestoryChanged event on the tool. Still, for some reason, it is not being called when I listen for it in my main gun system server script located in ServerScriptService. I have tried placing a server script directly parented underneath the tool and then listening there and it works. I believe this happens because the tool gets cloned automatically when in StarterPack, but I thought events like AncestoryChanged were cloned with the instance.

If you have any advice on how to modify this to work, that would be awesome. I want to keep the server side underneath one script but if that is not possible, what should I do? I could parent another server script to the gun, but still, I would like to keep it underneath one server script as I have right now.

-- Services
local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Players = game:GetService("Players")

-- Modules
local GunController = require(script.GunController)

-- Classes
local GlobalSettings = require(script.GlobalSettings)

for _, folder: Folder in pairs(GlobalSettings.guns) do
	for _, gun in pairs(folder:GetChildren()) do
		if not gun:IsA("Tool") then continue end
		
		local gunConfig = gun:FindFirstChildOfClass("ModuleScript")
		
		if gunConfig and gunConfig.Name == "GunSettings" then
			gun.AncestryChanged:Connect(function(_, parent)
				print(parent)
			end)
			
			local setupGun = GunController.new(gun)
		else
			warn(`{gun.Name} is not a valid gun.`)
		end
	end
end

GlobalSetttings.guns is just an array of folders that I have to search for guns in. Right now I have it set to { game.StarterPack }.

Event bindings are not cloned with models or parts. Each time a new copy of the gun is created, you need to create the bindings. If you want the Script in ServerScriptService to do it, you’ll need to be getting the reference to the gun in Players->PlayerName->Backpack->gun each time they respawn, and updating the binding to that copy of the gun.

You can have the server Script set up a binding for each player to Players->PlayerName.ChildAdded, and that will fire each time their Backpack gets deleted and recreated on the server when they respawn. Anytime it fires and the argument of the event is “Backpack”, you’d have their new Backpack reference that you then have to find the gun inside.

Thank you for your help, modified the system to take these issues into account.