this is a > local script inside of a button, when the button is clicked, it's supposed to remove the player's hats (accessories).
local player = game.Players.LocalPlayer
local char = player.Character
script.Parent.MouseButton1Down:Connect(function()
local character = char:FindFirstChild("Humanoid").Parent
for _, acces in ipairs(character:GetChildren()) do
if acces.ClassName == "Accessory" then
acces:Destroy()
end
end
end)

1 comment
Have you tried using a RemoteEvent? Usually those work, especially for FE.