fwep67
|
  |
| Joined: 21 Nov 2009 |
| Total Posts: 352 |
|
|
| 18 Jan 2015 12:46 PM |
| So im trying to make a script where it changes any characters cloths and hat to anything, how do I get rid of the hats inside their character if they are named various titles. |
|
|
| Report Abuse |
|
|
ohno1112
|
  |
| Joined: 23 Mar 2013 |
| Total Posts: 833 |
|
|
| 18 Jan 2015 01:06 PM |
for i,v in pairs(workspace.Playername:GetChildren()) do if v.ClassName == "Hat" then v:Destroy() end end |
|
|
| Report Abuse |
|
|
|
| 18 Jan 2015 01:10 PM |
no you dont want to do it like that ohno
@OP
for i, v in pairs(char:GetChildren())) do if v:IsA'Hat' then v:Destroy() end end |
|
|
| Report Abuse |
|
|
Goulstem
|
  |
| Joined: 04 Jul 2012 |
| Total Posts: 7177 |
|
|
| 18 Jan 2015 01:16 PM |
If they are various titles?
local hatNames = {"Dominus Empyreus","Hat","OtherHat"}
game.Players.PlayerAdded:connect(function(plr) plr.CharacterAdded:connect(function(char) char:WaitForChild("Torso");wait(.5) for i,v in pairs(char:GetChildren()) do if v:IsA("Hat") then for a,b in pairs(hatNames) do if v.Name == b then v:Destroy() end end end end end) end)
Just removing all hats?
game.Players.PlayerAdded:connect(function(plr) plr.CharacterAdded:connect(functon(char) char:WaitForChild'Torso';wait'.5'; for i,v in pairs(char:GetChildren'') do if v:IsA'Hat' then v:Destroy'' end end end) end) |
|
|
| Report Abuse |
|
|
|
| 18 Jan 2015 01:17 PM |
Don't do what GoulStem said for the title thing, it would technically work but you'd have to know the name of the actual hat in Studio. They usually give the hats very odd names (sometimes as jokes) and so it won't really work.
Just remove all hats. |
|
|
| Report Abuse |
|
|
Goulstem
|
  |
| Joined: 04 Jul 2012 |
| Total Posts: 7177 |
|
|
| 18 Jan 2015 01:20 PM |
^m8. don't bash on me just because it's a terrible way to do it, I know that.. but he asked for it lol.
"...how do I get rid of the hats inside their character if they are named various titles."
~OP |
|
|
| Report Abuse |
|
|