game.Players.PlayerAdded:Connect(function(plr)
plr.CharacterAdded:Connect(function(char)
local backpack = plr:FindFirstChild("Backpack")
local cloneTool = game:GetService("ServerStorage").HatFolder.Hat:Clone()
cloneTool.Parent = backpack
cloneTool.Activated:Connect(function(Clicked)
for i, v in pairs (char:GetChildren()) do
if v.ClassName == "Accessory" then
v:Destroy()
end
end
for i, v in pairs (char:GetChildren()) do
if v.ClassName == "Hat" then
v:Destroy()
local Hat = game.GetService("ServerStorage").HatFolder.WearableHat:Clone()
Hat.Parent = char.Humanoid
end
end
end)
end)
end)
I was successful with holding the hat in my backpack as a tool and removing all my accessories. However, I am unable to wear the hat and am unsure of where I am going wrong, I also need help with removing the tool once the hat is worn. BTW- I have two hats in my ServerStorage as one will be used as a tool while the other is an accessory. Sorry for the bad layout and mistake, I am fairly new
