Help Fixing my tool script

So I made xbox controls for my tool but it turns on when I press the button without having it in my hand I made this but Idek if it’s right so I want to see if i’m wrong. Can you guys assist me?

local UIS = game:GetService("UserInputService")
local Event = script.Parent.Event
local Enabled = false
local Cooldown = false
local player = game.Players.LocalPlayer
local Character = player.Character
local Tool = script.Parent.Parent.Parent

UIS.InputBegan:Connect(function(input, IT)
	-------------Ignite-----------
	    if not Tool then   ----The part I added 
	    if input.KeyCode == Enum.KeyCode.ButtonR1 then ---- The xbox control part
		if IT == true then return end
		if Character:FindFirstChild("Attack") then return end
		if Character:FindFirstChild("Throw") then return end
		if Character:FindFirstChild("Gliding") then return end
		-------------CoolDown-----------
		if Cooldown == true then return end
		
		Cooldown = true
		
		spawn(function()
			
			wait(0.5)
			
			Cooldown = false
			
		end)
		-------------Enabled-----------
		if Enabled == true then
			
			Enabled = false
			
			print("Disable")
			
			Event:FireServer("Unignite")
			
		elseif Enabled == false then
			
			Enabled = true
			
			print("Enable")
			
			Event:FireServer("Ignite")
		
		end
		end
	end
end)