|
| 29 Oct 2015 04:26 PM |
Attempting to delete things that aren't in the list of what to keep, but the character keeps dying when I run it. Is there something else that can't be deleted or what's up with it?
Keep = { "Part", "Script", "LocalScript", "Humanoid"} game.Players.PlayerAdded:connect(function(Plyr) Plyr.CharacterAdded:connect(function(Char) wait(1) local Parts = Char:GetChildren() for i, v in pairs(Keep) do if Parts[i].ClassName ~= v then Parts[i]:Remove() end end end) end) |
|
|
| Report Abuse |
|
|
|
| 29 Oct 2015 04:26 PM |
"Humanoid"
are you trolling? |
|
|
| Report Abuse |
|
|
|
| 29 Oct 2015 04:31 PM |
| Err, no. Has something changed with them? I haven't touched humanoids/characters for a long time. |
|
|
| Report Abuse |
|
|
|
| 29 Oct 2015 04:35 PM |
| Thought that characters would die if you destroy their humanoids |
|
|
| Report Abuse |
|
|
|
| 29 Oct 2015 04:36 PM |
| That list is what gets an exclusion from being deleted. |
|
|
| Report Abuse |
|
|
|
| 29 Oct 2015 04:37 PM |
| ok lol ignore me I'm going to bed bye |
|
|
| Report Abuse |
|
|
|
| 29 Oct 2015 04:42 PM |
Keep = { "Part", "Script", "LocalScript", "Humanoid"} game.Players.PlayerAdded:connect(function(Plyr) Plyr.CharacterAdded:connect(function(Char) wait(1) local Parts = Char:GetChildren() for _,v in ipairs(Parts) do if not Keep[v.ClassName] then v:Destroy() end end end) end) |
|
|
| Report Abuse |
|
|
|
| 29 Oct 2015 04:45 PM |
| That deleted everything inside the player. |
|
|
| Report Abuse |
|
|
|
| 29 Oct 2015 07:46 PM |
| Still haven't figured this out if anyone is interested. |
|
|
| Report Abuse |
|
|
|
| 29 Oct 2015 07:49 PM |
Keep = { Part = 0, --must be non-nil Script = 0, LocalScript = 0, Humanoid = 0 }
game.Players.PlayerAdded:connect(function(Plyr) Plyr.CharacterAdded:connect(function(Char) wait(1) local Parts = Char:GetChildren() for _,v in pairs(Parts) do --ipairs iterates over integer keys, not string keys like you are trying to do if not Keep[v.ClassName] then
Should work now. |
|
|
| Report Abuse |
|
|
|
| 29 Oct 2015 08:03 PM |
| Yup, it was a success. Thanks. |
|
|
| Report Abuse |
|
|