Any help with this accessory remover?

So this script is supposed to appear all accessorys besides one named mask, but it does not work any help??

local re = script.Parent.RemoveMask

re.OnServerEvent:Connect(function(player)
	local character = player.Character
			wait(1)
			local d = character:GetChildren()
			for i=1, #d do
				if (d[i].className == "Accessory") and not d.Name == "Mask" then
					d[i].Handle.Transparency = 0 
				end
			end
			character.Mask:Destroy()
				local dog = character.BlackMask or player.Backpack.BlackMask
				dog.Handle.Transparency = 0
				character.Head.Hidden.Enabled = false
				character.Head.Title.Enabled = true
			end)
1 Like

try using the GetAccessories() function instead like this:

local re = script.Parent.RemoveMask

re.OnServerEvent:Connect(function(player)
	local character = player.Character or player.CharacterAdded:wait()
	local humanoid = character:FindFirstChild("Humanoid")
	local accessories = humanoid:GetAccessories()
	wait(1)
	for _,accessory in pairs(accessories)do
		if not accessory.Name == "Mask" then
			for _,child in pairs(accessory:GetChildren())do
				if child.Transparency then
					child.Transparency = 1
				end
			end
		end
	end
	--im not sure what you are doing here:
	character.Mask:Destroy()
	local dog = character.BlackMask or player.Backpack.BlackMask
	dog.Handle.Transparency = 0
	character.Head.Hidden.Enabled = false
	character.Head.Title.Enabled = true
end)
	

this did not work? Any help??? No output errors either

you need to be more clear on what error is happening, are the accessories being removed? and did you actually fire the remote event

The accessorys are not coming back and the mask is not getting removed

you said you want the accessories to be removed?

I just want to remove the thing named “beard” and bring it back, I didnt specify sorry.

local re = script.Parent.RemoveMask

re.OnServerEvent:Connect(function(player)
	local character = player.Character
			wait(1)
			local d = character:GetChildren()
			for i=1, #d do
				if (d[i].className == "Accessory") and d.Name == "Beard" then
					d[i].Handle.Transparency = 0 
				end
			end
character.MaskForHide:Destroy()
				local dog = character.BlackMask or player.Backpack.BlackMask
				dog.Handle.Transparency = 0
				character.Head.Hidden.Enabled = false
				character.Head.Title.Enabled = true
			end)

try this:

local re = script.Parent.RemoveMask

re.OnServerEvent:Connect(function(player)
	local character = player.Character or player.CharacterAdded:wait()
	local humanoid = character:FindFirstChild("Humanoid")
	local accessories = humanoid:GetAccessories()
	wait(1)
       -- this will remove the beard
	for _,accessory in pairs(accessories)do
		if accessory.Name == "Beard" then
			for _,child in pairs(accessory:GetChildren())do
				if child.Transparency then
					child.Transparency = 1
				end
			end
		end
	end
	--im not sure what you are doing here:
	character.MaskForHide:Destroy()
	local dog = character.BlackMask or player.Backpack.BlackMask
	dog.Handle.Transparency = 0
	character.Head.Hidden.Enabled = false
	character.Head.Title.Enabled = true
end)
	

It works not, but for some reason its giving me 2 mask accessorys and I have no clue as to why just by simply looking at the script.

local re = script.Parent.GiveMask

re.OnServerEvent:Connect(function(player)
	local character = player.Character
	local humanoid = character:FindFirstChild("Humanoid")
	local accessories = humanoid:GetAccessories()
			wait(1)
	for _,accessory in pairs(accessories)do
		if accessory.Name == "Beard" then
			for _,child in pairs(accessory:GetChildren())do
				if child.Transparency then
					child.Transparency = 1
				end
			end
			end
			if character:FindFirstChild("Humanoid") ~= nil then -- Accessory script
				local h = Instance.new("Accessory")
				local p = Instance.new("Part")
				h.Name = "Mask"
				p.Parent = h
				p.Position = character:FindFirstChild("Head").Position
				p.Name = "Handle"
				p.BrickColor = BrickColor.new("Really black") 
				p.formFactor = 0
				p.Size = Vector3.new(1.358, 0.934, 0.819) 
				p.BottomSurface = 0
				p.TopSurface = 0
				p.Locked = true
				script.Parent:WaitForChild("Mesh"):Clone().Parent = p
				h.Parent = character
				print("It should work")
				h.AttachmentPos = Vector3.new(0, 0.7, 0.03)
				wait(.1)
			end
	end
	end)

try this:


re.OnServerEvent:Connect(function(player)
	local character = player.Character
	local humanoid = character:FindFirstChild("Humanoid")
	local accessories = humanoid:GetAccessories()
			wait(1)
	for _,accessory in pairs(accessories)do
		if accessory.Name == "Beard" then
			for _,child in pairs(accessory:GetChildren())do
				if child.Transparency then
					child.Transparency = 1
				end
			end
		end
     end
	if character:FindFirstChild("Humanoid") ~= nil then -- Accessory script
		local h = Instance.new("Accessory")
		local p = Instance.new("Part")
		h.Name = "Mask"
		p.Parent = h
		p.Position = character:FindFirstChild("Head").Position
		p.Name = "Handle"
		p.BrickColor = BrickColor.new("Really black") 
		p.formFactor = 0
		p.Size = Vector3.new(1.358, 0.934, 0.819) 
		p.BottomSurface = 0
		p.TopSurface = 0
		p.Locked = true
		script.Parent:WaitForChild("Mesh"):Clone().Parent = p
		h.Parent = character
		print("It should work")
		h.AttachmentPos = Vector3.new(0, 0.7, 0.03)
		wait(.1)
	end
end)
1 Like

Ahhh yes, perfect, thank you so much :slight_smile:

mark it as the solution since the topic is solved click the box with the tick in it on the post

Don’t mark your post as the solution, since it solved nothing. Mark the post that actually solved the problem as the solution.

1 Like