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 » Scripting Helpers
Home Search
 

Re: A script that removes any foreign bricks on the player

Previous Thread :: Next Thread 
Boksunni1 is not online. Boksunni1
Joined: 13 May 2009
Total Posts: 485
02 Nov 2013 12:02 AM
I have a scuba suit brick that welds portions of a scuba suit onto the player. Each portion is a Model named Leg1, Arm1, Chest, etc. I've tried to edit the hat remover script in the hat remover brick, but to no avail. Any help guys?
Report Abuse
Boksunni1 is not online. Boksunni1
Joined: 13 May 2009
Total Posts: 485
02 Nov 2013 12:07 AM
This is the script for hat removal is it makes it any easier.

function onTouched(hit)
local d = hit.Parent:GetChildren()
for i=1, #d do
if (d[i].className == "Hat") then
d[i]:remove()
end
end
end

script.Parent.Touched:connect(onTouched)
Report Abuse
flatline115 is not online. flatline115
Joined: 29 Jul 2013
Total Posts: 7826
02 Nov 2013 12:13 AM
Just check the name of d[i] if it matches a table of items you want to remove then Destroy it. using :Destroy() never use :remove() it is deprecated and'll lag your game up as it just reparents it to nil.
Report Abuse
Boksunni1 is not online. Boksunni1
Joined: 13 May 2009
Total Posts: 485
02 Nov 2013 12:21 AM
What does it technically mean when i=1?
Sorry, I'm really bad at the scripting business.
Report Abuse
lampwnage121 is not online. lampwnage121
Joined: 20 Oct 2012
Total Posts: 4285
02 Nov 2013 12:29 AM
for i = 1,5 do print(i) end
>1
>2
>3
>4
>5
Report Abuse
Boksunni1 is not online. Boksunni1
Joined: 13 May 2009
Total Posts: 485
02 Nov 2013 12:34 AM
I guess a better question is what is "i"?
I've tried searching on lua learning websites and I can't seem to see it at all, ( Since I don't know its practical uses)

I'm very sorry guys for those who are annoyed at me. I just never had the time to read up all this stuff :\
Report Abuse
TheEliteDonphan is not online. TheEliteDonphan
Joined: 16 Jun 2013
Total Posts: 2647
02 Nov 2013 12:36 AM
[ Content Deleted ]
Report Abuse
Boksunni1 is not online. Boksunni1
Joined: 13 May 2009
Total Posts: 485
02 Nov 2013 12:38 AM
so when it was set to 1, what exactly was it defining? I didn't understand what "1" had to do with finding the hat.
Report Abuse
flatline115 is not online. flatline115
Joined: 29 Jul 2013
Total Posts: 7826
02 Nov 2013 12:43 AM
d is a table full of whatever's children. To access what is in this table we need the number of its placement doing for i = 1, #d starts i at one and goes up one by one till it is done with whatever number #d the operator is. So we put d then brackets and finally i to represent the location of the data that we wish to access.
Report Abuse
Boksunni1 is not online. Boksunni1
Joined: 13 May 2009
Total Posts: 485
02 Nov 2013 12:55 AM
Oh I see... Thanks for clarifying. I'll tinker with this script and see and I can do lol. Even with years of playing, I never got really get into scripting.
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • 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