Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How to remove player character items such as hats?

Asked by 8 years ago

Is there a script for this? I tried this:

local prev
local parts = script.Parent:GetChildren()
for i = 1,#parts do
--remove any of the following parts that say "(parts[i].className == [className])" if you want to exclude that particular className type from the Weld
    if ((parts[i].className == "Hat")) then
        if (prev ~= nil) then
            parts[i]:Destroy()
        end
        prev = parts[i]
    end
end
wait(3)
0
So you want the player to not have any hats or shirts and etc? EzraNehemiah_TF2 3552 — 8y
0
Yes NAWESOME14 40 — 8y

2 answers

Log in to vote
0
Answered by 8 years ago

Use a method called, ClearCharacterAppearance. This clears all hats, shirts, pants, character meshes(packages) and etc.


Final Product

game:GetService("Players").PlayerAdded:connect(plyr)
    plyr.CharacterAdded:connect(char)
        plyr:ClearCharacterAppearance()
    end)
end)

Hope it helps!

0
I just used the one on the wiki, but thank you so much :D NAWESOME14 40 — 8y
Ad
Log in to vote
-1
Answered by 8 years ago

I tried, I didn't test. Idk if it'll work. But tell me if it works.

game.Players.PlayerAdded:connect(function(plr)
    plr.CharacterAdded:connect(function(character)
        character:WaitForChild("Hat")
wait(2)
     character.Hat:Destroy
end)
end)

I do not know if this will work.. I'm kind of a newbie to scripting.. so.. I hope I helped.

0
Wrong. BinaryResolved 215 — 8y
0
I can already tell you this won't work because every Hat is named something different. Hat is the ClassName NAWESOME14 40 — 8y
0
But thank you for trying :) NAWESOME14 40 — 8y

Answer this question