how can i make the tool only work if its equipped

this is the local

///////////////////////////

local Player = game:GetService("Players")
local rp = game:GetService("ReplicatedStorage")
local plr = game.Players.LocalPlayer

local MaxKobosRemotes = rp:WaitForChild("MaxKobosRemotes")
local KiritosSword = MaxKobosRemotes:WaitForChild("KiritosSword")
local tool = script.Parent
local UIS = game:GetService("UserInputService")

local debounce = false
local cooldown = 60

UIS.InputBegan:Connect(function(input,isTyping)
	if isTyping then	 
		return

	
		
		

elseif input.KeyCode == Enum.KeyCode.F and debounce == false then
	debounce = true

	KiritosSword:FireServer()
					


	
	end
end)

KiritosSword.OnClientEvent:Connect(function()
		

		wait(cooldown)
	debounce = false
end)

//////////////////////////

heres script

//////////////////////////////

local rp = game:GetService("ReplicatedStorage")
local MaxKobosRemotes = rp:WaitForChild("MaxKobosRemotes")

local KiritosSword = MaxKobosRemotes:WaitForChild("KiritosSword")
		local player = game:GetService("Players").LocalPlayer
		local plr = game.Players.LocalPlayer
	local Animation = game.Workspace.MaxKobosAnimations:WaitForChild("Swing") 
	debounce = true


	
	local tool = script.Parent
local Buffed = tool:WaitForChild("Buffed")

local HitBox = tool:WaitForChild("HitBox")
local Blade = script.Parent:WaitForChild("Blade")
local Particle1 = Blade:WaitForChild("Lightning1")
local Particle2 = Blade:WaitForChild("Lightning2")
local Particle3 = Blade:WaitForChild("ParticleEmitter")


	KiritosSword.OnServerEvent:Connect(function(Player)
    local Character = Player.Character 
    local Humanoid = Character:FindFirstChild("Humanoid")
    local Swing = Humanoid:LoadAnimation(Animation) 
    Swing:Play() 
    KiritosSword:FireClient(Player)
wait(1)
	Particle1.Enabled = true
	Particle2.Enabled = true
    Particle3.Enabled = true
	print("Buffed")
	
	Buffed.Value = true
	
	wait(20)
	
		Particle1.Enabled = false
		Particle2.Enabled = false
	    Particle3.Enabled = false
Buffed.Value = false
	print("BuffOver")

wait(1)
debounce = false



end)

/////////////////////////////