Multiple tools not works

Good day,

So, I have problem. I make gun system but it not works ompletely .

When I have only one gun in my inventory, then it works. But when I have 2 and more gun (Im not counting lightsabers) then work only one gun. There is my video. My shotgun works on ContextActionService but Hand Blaster works on tool.Activated

I tried change “tool.Equipped” to “ContextActionService.LocalToolActivated”. But it didn’t work. When I equipped one gun then it equipped other gun.

Here is my script:

-- 29.03.2022 --
-- by Rajin98 --
-- All things are reserved to Rajin98 --

----------
-- INIT --
----------

repeat wait() until game:IsLoaded()

repeat wait() until game.Players.LocalPlayer.Character

---------------
-- VARIABLES --
---------------

local RS = game:GetService("ReplicatedStorage")
local uis = game:GetService("UserInputService")
local cas = game:GetService("ContextActionService")
local RunService = game:GetService("RunService")
local Players = game:GetService("Players")

local tool = script.Parent
local GUI = tool.GunUI
local GunEvent = RS:WaitForChild("GunEvent")
local Sounds = tool.Sounds
local plr = Players.LocalPlayer
local Animations = tool.Animations
local mouse = plr:GetMouse()

local Muzzle = tool:WaitForChild("Muzzle")

local mouseIconId = "rbxassetid://4264273816"

local Settings = require(tool.GunSettings)

local shooting = false
local equipped = false
local canShoot = true
local isSafe = false

local Rate = Settings.FireRate
local MaxAmmo = Settings.MaxAmmo
local Ammo = MaxAmmo

local Idle = Animations.Idle
local Reload = Animations.Reload
local Safe = Animations.Safe

local loadedIdle = plr.Character:WaitForChild("Humanoid"):LoadAnimation(Idle)
local loadedReload = plr.Character:WaitForChild("Humanoid"):LoadAnimation(Reload)
local loadedSafe = plr.Character:WaitForChild("Humanoid"):LoadAnimation(Safe)

---------------
-- DEBOUNCES --
---------------

tool.Equipped:Connect(function()
	for i,v in pairs(script.Parent:GetChildren()) do
	mouse.Icon = mouseIconId
	equipped = true
	GUI.Frame.AmmoText.Text = Ammo.."/"..MaxAmmo
	GUI.Parent = plr.PlayerGui	
	loadedIdle:Play()
	end
	
end)

tool.Unequipped:Connect(function()
	plr.PlayerGui:FindFirstChild("GunUI").Parent = tool
	equipped = false
	mouse.Icon = ""
	loadedIdle:Stop()
	loadedReload:Stop()
end)

---------------
-- FUNCTIONS --
---------------

function safe()
	if equipped == true then
		if isSafe == false then
			isSafe = true
			canShoot = false
			loadedSafe:Play()
		else
			isSafe = false
			canShoot = true
			loadedSafe:Stop()
		end
	end
end

function reload()
	if equipped == true then
		Sounds.ReloadSound:Play()
		loadedReload:Play()
		canShoot = false
		wait(Settings.ReloadWait)
		Ammo = MaxAmmo
		GUI.Frame.AmmoText.Text = Ammo.."/"..MaxAmmo
		canShoot = true
	end
end

function clicked(actionName, Status)
	if equipped == true then
		if actionName == "ShootGun" then
		if Status == Enum.UserInputState.Begin then
			shooting = true
		end
		
		if Status == Enum.UserInputState.End then
			shooting = false
		end
		end
	end
		
end

function bullet()
	if equipped == true then
		if canShoot == true then
		if Ammo ~= 0 then
			Sounds.FireSound:Play()
			Ammo -= 1
			plr.PlayerGui:FindFirstChild("GunUI").Frame.AmmoText.Text = Ammo.."/"..MaxAmmo
			canShoot = false
			GunEvent:FireServer(tool, Muzzle.Position, mouse.Hit.Position, Settings.Damage)
			wait(Rate)
			canShoot = true
		end
	end	
	end
	
end

-----------------
-- UIS and CAS --
-----------------

cas:BindAction("ShootGun", clicked, true, Enum.UserInputType.MouseButton1, Enum.UserInputType.Gamepad1)

uis.InputBegan:Connect(function(keyPress, proceed)
	if proceed then return end
	
	if keyPress.KeyCode == Enum.KeyCode.R then
		reload()
	end
end)

uis.InputBegan:Connect(function(keyPress, proceed)
	if proceed then return end
	
	if keyPress.KeyCode == Enum.KeyCode.F then
		safe()
	end
end)

--------------------
-- RENDER STEPPED --
--------------------

RunService.RenderStepped:Connect(function()
	if shooting == true then
		bullet()
	end
end)

Try not using ContextActionService, use tool.Activated and to check if the mouse button is pressed use uis:IsMouseButtonPressed(Enum.UserInputType.MouseButton1), let me know if that helped.

Thanks for solution! It works.