ColdSmoke
|
  |
| Joined: 02 Jan 2012 |
| Total Posts: 5784 |
|
|
| 11 May 2014 01:15 PM |
I'm trying to do this
Game.Players.PlayerAdded:connect(function(Player) Player.CharacterAdded:connect(function(Character) for i,v in pairs(Character:GetChildren()) do if v:IsA("Hat") or v:IsA("Shirt") or v:IsA("Pants") then v:Destroy() end end
end) end)
-- But alas, it won't remove hats, shirts, or pants? why? |
|
|
| Report Abuse |
|
|
|
| 11 May 2014 01:16 PM |
| They havent loaded, use :WaitForChild() before removing. |
|
|
| Report Abuse |
|
|
ColdSmoke
|
  |
| Joined: 02 Jan 2012 |
| Total Posts: 5784 |
|
|
| 11 May 2014 01:18 PM |
| But which child do I wait for? It's not guaranteed that said character will even have any of these things? |
|
|
| Report Abuse |
|
|
| |
|
|
| 11 May 2014 01:22 PM |
game.Players.PlayerAdded:connect(function(p) p.CharacterAdded:connect(function(c)
p:WaitForDataReady()
for m, c in pairs(c:children()) do if c.className == "Hat" or c.className == "Shirt" or c.className == "Pants" then c:remove() end end
end) end) |
|
|
| Report Abuse |
|
|
|
| 11 May 2014 01:24 PM |
game.Players.PlayerAdded:connect(function(player) player:WaitForDataReady() player.CharacterAdded:connect(function(char) for _, v in pairs(char:GetChildren()) do if v.ClassName == "Shirt" or v.ClassName == "ShirtGraphic" or v.ClassName == "Hat" or v.ClassName == "Pants" then v:Destroy() end end end) end) |
|
|
| Report Abuse |
|
|
|
| 11 May 2014 01:25 PM |
^
Not really sure but if you use :WaitForDataReady() and then add a characteradded event, won't it fail? |
|
|
| Report Abuse |
|
|
|
| 11 May 2014 01:26 PM |
| Oh, put it in the wrong spot, use Jimmy's |
|
|
| Report Abuse |
|
|
ColdSmoke
|
  |
| Joined: 02 Jan 2012 |
| Total Posts: 5784 |
|
|
| 11 May 2014 01:27 PM |
| Oh hmm, I got it by adding in a ChildAdded event, but that looks more efficient |
|
|
| Report Abuse |
|
|
|
| 11 May 2014 01:28 PM |
Game.Players.PlayerAdded:connect(function(Player)
Player.CharacterAdded:connect(function(Character) wait(2)--ive found sometimes I got to add a wait of some kind for i,v in pairs(Character:GetChildren()) do if v:IsA("Hat") or v:IsA("Shirt") or v:IsA("Pants") then v:Destroy() end end
end) end) |
|
|
| Report Abuse |
|
|
|
| 11 May 2014 01:29 PM |
| @Island, some people have really slow computers and a wait(2) wont be enough. :WaitForDataReady() waits until theyve completely loaded. |
|
|
| Report Abuse |
|
|
ColdSmoke
|
  |
| Joined: 02 Jan 2012 |
| Total Posts: 5784 |
|
|
| 11 May 2014 01:29 PM |
| ehh the wait could vary though. and I want it to be instant. I've got what I need working though so thanks everyone. |
|
|
| Report Abuse |
|
|
|
| 11 May 2014 01:30 PM |
WaitForDataReady() waits until they can load/save data meh,idk |
|
|
| Report Abuse |
|
|
|
| 11 May 2014 01:32 PM |
Game.Players.PlayerAdded:connect(function(Player) Player.CharacterAdded:connect(function(Character) Character.ChildAdded:connect(function(c) if c:IsA("Hat")or c:IsA("Shirt")or c:IsA("Pants")then c:Destroy() end end) end) end) |
|
|
| Report Abuse |
|
|
|
| 11 May 2014 01:33 PM |
Game.Players.PlayerAdded:connect(function(Player) Player.CharacterAdded:connect(function(Character) Character.ChildAdded:connect(function(c) if c:IsA("Clothing")then c:Destroy() end end) end) end)
bam |
|
|
| Report Abuse |
|
|
|
| 11 May 2014 01:48 PM |
How about I show you how it's done :)?
game.Players.PlayerAdded:connect(function(Player) Player.CanLoadCharacterAppearance = false end)
Now they are a classic noob model without any customization. |
|
|
| Report Abuse |
|
|
ColdSmoke
|
  |
| Joined: 02 Jan 2012 |
| Total Posts: 5784 |
|
|
| 11 May 2014 03:42 PM |
| Oh that's handy Aether, though I want to keep custom faces or T-Shirts(for now) |
|
|
| Report Abuse |
|
|