Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How to create a hat remover script?

1 answer

Rule 3 of the community guidelines states:

  1. Answers must show reasonable attempt to solve the question. --> Explain what went wrong. --> Provide code as an example. Include the explanation of the code.

As for your question, I'll answer it, but don't repeat this.

local playerName = "ROBLOX"
local player = game:GetService("Players"):FindFirstChild(playerName)

if player and player:IsA("Player") then
    local char = player.Character
    if char then
        local hum = char:FindFirstChildWhichIsA("Humanoid")
        if hum then
            hum:RemoveAccessories()
	end
    end
end

The player's humanoid has a method called RemoveAccessories().

Call that, it will remove their hats.

Don't repeat this style of question in future, please.

This discussion is preserved as it was. New answers, comments, and votes are closed.