generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

Re: Help with deleting portions of a Player.

Previous Thread :: Next Thread 
ultraweirdo98 is not online. ultraweirdo98
Joined: 01 Mar 2010
Total Posts: 130
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
Happywalker is not online. Happywalker
Joined: 05 Mar 2010
Total Posts: 3672
29 Oct 2015 04:26 PM
"Humanoid"

are you trolling?
Report Abuse
ultraweirdo98 is not online. ultraweirdo98
Joined: 01 Mar 2010
Total Posts: 130
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
Happywalker is not online. Happywalker
Joined: 05 Mar 2010
Total Posts: 3672
29 Oct 2015 04:35 PM
Thought that characters would die if you destroy their humanoids
Report Abuse
ultraweirdo98 is not online. ultraweirdo98
Joined: 01 Mar 2010
Total Posts: 130
29 Oct 2015 04:36 PM
That list is what gets an exclusion from being deleted.
Report Abuse
Happywalker is not online. Happywalker
Joined: 05 Mar 2010
Total Posts: 3672
29 Oct 2015 04:37 PM
ok lol ignore me I'm going to bed bye
Report Abuse
Happywalker is not online. Happywalker
Joined: 05 Mar 2010
Total Posts: 3672
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
ultraweirdo98 is not online. ultraweirdo98
Joined: 01 Mar 2010
Total Posts: 130
29 Oct 2015 04:45 PM
That deleted everything inside the player.
Report Abuse
ultraweirdo98 is not online. ultraweirdo98
Joined: 01 Mar 2010
Total Posts: 130
29 Oct 2015 07:46 PM
Still haven't figured this out if anyone is interested.
Report Abuse
cody123454321 is not online. cody123454321
Joined: 21 Nov 2009
Total Posts: 5408
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
ultraweirdo98 is not online. ultraweirdo98
Joined: 01 Mar 2010
Total Posts: 130
29 Oct 2015 08:03 PM
Yup, it was a success. Thanks.
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image