Im new to scripting but im learning....
im trying to create a script that removes clothes,hats,pants from players at the start. ive come up with this:
player = script.Parent.Parent mouse = player:GetMouse() character = player.Character wait(0.1) print(character) wait(5) character.Pants:Remove() character.Shirt:Remove() hat = character.Hat hat:Remove()
my problem is the following:
hats tend to have diffrent names (mine is: WizardHatWithBeard) so doing
character.Hat:Remove()
wont work. Doing...
character:GetFirstChild("Hat")
wont work either.
So is there a way to search for the specific class? like removing all shirts, pants, hats
Since hats do not have a specific name and users can have multiple hats, it would be best to use a loop to check to see if each instance in their character is a hat and you can also use this for shirt and pants in case the shirt/pants are not named 'Shirt' or 'Pants'.
for k, r in pairs(player.Character:GetChildren()) do if r:IsA('Hat') or r:IsA('Shirt') or r:IsA('Pants') then r:Remove() end end