Hello,

I'm trying to make a localscript able to send functions for each gun in the players backpack, but it only prints "hello" and "hello again".

If i click, or Unequip the tool, it doesn't do anything.

function Activatez(InstanceTool,MouseDown)
	print(InstanceTool.Name, MouseDown)
end


repeat wait() until #script.Parent:GetChildren() >= #game.StarterPack:GetChildren()

for _,v in pairs(script.Parent:GetChildren()) do
	
	local a,b = pcall(function()
		
		if v:IsA("Tool") and v:FindFirstChild("IsGun") and v.IsGun.Value then
			
			print("Hello!") -- < that does print
			
			v.Activated:Connect(function()
				print("Act.")
				Activatez(v,true)
			end)
			
			v.Deactivated:Connect(function()
				print("Deact.")
				Activatez(v,false)
			end)
			
			v.Unequipped:Connect(function()
				print("Uneq.")
				Activatez(v,false)
			end)
			
			print("Hello, again!") -- < Also prints
		end
		
	end)
	
	if not a then warn(b) end
	
end

1 comment

0

Ok nvm, didn't have a handle ;-;