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

How to remove player character items such as hats?

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)

2 comments

0

So you want the player to not have any hats or shirts and etc?

0

Yes

2 answers

✓ Accepted answer

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!

1 comment

0

I just used the one on the wiki, but thank you so much :D

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.

3 comments

0

Wrong.

0

I can already tell you this won't work because every Hat is named something different. Hat is the ClassName

0

But thank you for trying :)

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