|
| 08 Sep 2013 01:12 PM |
It works when someone dies in build mode, but not when they join. It also doesn't work at all online.
function onAdded(character) wait() find = character:FindFirstChild("Torso") if find ~= nil then meshs = character:GetChildren() for i = 1,#meshs do if meshs[i].ClassName == "CharacterMesh" or meshs[i].ClassName == "Hat" or meshs[i].ClassName == "ShirtGraphic" or meshs[i].ClassName == "Shirt" or meshs[i].ClassName == "Pants" then meshs[i]:Remove() end end tshirt = find:FindFirstChild("roblox") if tshirt ~= nil then tshirt:Remove() end end end
game.Players.PlayerAdded:connect(function(player) print(player.Character) player.CharacterAdded:wait() onAdded(player.Character) end)"
game.Workspace.ChildAdded:connect(onAdded,character)
|
|
|
| Report Abuse |
|
|
|
| 08 Sep 2013 01:14 PM |
| It's obviously a connection problem. I guess I don't know how to wait for the character? I don't know.. |
|
|
| Report Abuse |
|
|
DrProx
|
  |
| Joined: 18 Nov 2009 |
| Total Posts: 1138 |
|
|
| 08 Sep 2013 01:19 PM |
function onAdded(character) wait(3) -- sometimes assets take a bit to load up for _,v in pairs(character:GetChildren()) do if v:IsA("CharacterMesh") or v:IsA("Hat") or v:IsA("Shirt") or v:IsA("Pants") or v:IsA("ShirtGraphic") do v:Destroy() end end tee = character:FindFirstChild("roblox", true) -- recursive search if tee then tee:Destroy() end end
game.Players.PlayerAdded:connect(function(p) repeat wait() until p.Character onAdded(p) p.CharacterAdded:connect(function(c) onAdded(c) end) end) |
|
|
| Report Abuse |
|
|
|
| 08 Sep 2013 01:23 PM |
| Thank you. That helped in many ways! |
|
|
| Report Abuse |
|
|
|
| 08 Sep 2013 01:27 PM |
| It still doesn't work the first time. Although I learned a few things from it. |
|
|
| Report Abuse |
|
|
DrProx
|
  |
| Joined: 18 Nov 2009 |
| Total Posts: 1138 |
|
|
| 08 Sep 2013 01:29 PM |
Oops, made a small typo:
function onAdded(character) wait(3) -- sometimes assets take a bit to load up for _,v in pairs(character:GetChildren()) do if v:IsA("CharacterMesh") or v:IsA("Hat") or v:IsA("Shirt") or v:IsA("Pants") or v:IsA("ShirtGraphic") do v:Destroy() end end tee = character:FindFirstChild("roblox", true) -- recursive search if tee then tee:Destroy() end end
game.Players.PlayerAdded:connect(function(p) repeat wait() until p.Character onAdded(p.Character) p.CharacterAdded:connect(function(c) onAdded(c) end) end) |
|
|
| Report Abuse |
|
|
|
| 08 Sep 2013 01:35 PM |
you should also replace 'do' with 'then'.
|
|
|
| Report Abuse |
|
|
DrProx
|
  |
| Joined: 18 Nov 2009 |
| Total Posts: 1138 |
|
|
| 08 Sep 2013 01:36 PM |
| Oops, didn't notice that. I'm scripting my own project as I patrol SH so I'm going a bit rushed. :P |
|
|
| Report Abuse |
|
|
|
| 08 Sep 2013 01:38 PM |
| Well thank you for your time sir. It works amazingly! If you need anything, I owe you one. Aha |
|
|
| Report Abuse |
|
|