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)
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)
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)
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)
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)