Tool adds/removes accessories even when unequipped

What I’m trying to do is make a tool that will add/destroy these two certain accessories.

The problem, however, is that even when the tool is unequipped, it will continue to add/destroy these accessories when the mouse is clicked. I’ve tried editing the script to detect when the tool is equipped but it doesn’t seem to work. I’ve even tried getting rid of the local script and remote event, but that breaks it.

Any and all help is appreciated with this strange issue.

Script:

local ISEquipped = false
local Mask = script:WaitForChild("Mask")
local Hood = script:WaitForChild("Hood")
script.Parent.Equipped:Connect(function()
	ISEquipped = true
end)
script.Parent.Unequipped:Connect(function()
	ISEquipped = false
end)

script.Parent.RemoteEvent.OnServerEvent:Connect(function(plr)
	if plr.Character:WaitForChild("Humanoid") then 
			if plr.Character:FindFirstChild("Mask") == nil then
				Mask:Clone().Parent = plr.Character
				Hood:Clone().Parent = plr.Character
			elseif plr.Character:FindFirstChild("Mask") then
				plr.Character.Mask:Destroy()
				plr.Character.Hood:Destroy()
			end
		end
	end)

Local Script:

local Player = game.Players.LocalPlayer
local mouse = Player:GetMouse()

mouse.Button1Down:Connect(function()
	script.Parent.RemoteEvent:FireServer()
end)

How the tool looks in the workspace:
Screenshot (145)

you made the ISEquipped but u didnt check if it’s true or false

so change the OnServerEvent function to

script.Parent.RemoteEvent.OnServerEvent:Connect(function(plr)
	if ISEquipped then
		if plr.Character:WaitForChild("Humanoid") then 
			if plr.Character:FindFirstChild("Mask") == nil then
				Mask:Clone().Parent = plr.Character
				Hood:Clone().Parent = plr.Character
			elseif plr.Character:FindFirstChild("Mask") then
				plr.Character.Mask:Destroy()
				plr.Character.Hood:Destroy()
			end
		end
	end
end)

Sadly, that seems to just break the tool. Do you happen to have anymore ideas that might help?

hmmm…
Change The LocalScrpt to

local Tool = script.Parent

Tool.Activated:Connect(function()
	script.Parent.RemoteEvent:FireServer()
end)

and The ServerScript to

local Mask = script:WaitForChild("Mask")
local Hood = script:WaitForChild("Hood")

script.Parent.RemoteEvent.OnServerEvent:Connect(function(plr)
	if plr.Character:WaitForChild("Humanoid") then 
			if plr.Character:FindFirstChild("Mask") == nil then
				Mask:Clone().Parent = plr.Character
				Hood:Clone().Parent = plr.Character
			elseif plr.Character:FindFirstChild("Mask") then
				plr.Character.Mask:Destroy()
				plr.Character.Hood:Destroy()
			end
		end
	end)

That also breaks it for some reason?? I’m really not sure what you’re doing wrong, there’s no errors in the script or output, it SHOULD be working.

thats kinda weird…
send me like a file for the tool and when i wake ill try to solve it…

Does your tool have RequiresHandle enabled? Equip and Unequip events won’t fire without a Handle unless you’ve turned that setting off, and it’s on by default.

Man, it was really that simple lol.
So, combined with @msix29 first reply and your input, I actually got it to work as intended. All I had to do was change the script a bit, add a part, and name it Handle. Thanks to both of you for the help.

You can also uncheck this box under the “Behavior” section if the handle isn’t desirable.
image

Glad I could help!