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 » Game Design
Home Search
 

Re: script error help please.

Previous Thread :: Next Thread 
enser14 is not online. enser14
Joined: 28 Oct 2012
Total Posts: 258
19 Oct 2015 01:31 PM
function ontouch(part)
if part.name == "nail" or part.Name == "WeldPart" then remove
end <==== the error
end
script.Parent.Touched:connect(ontouch)

says error were end is why is this?
Report Abuse
Solotaire is not online. Solotaire
Joined: 30 Jul 2009
Total Posts: 30356
19 Oct 2015 01:32 PM
you aren't removing anything
Report Abuse
enser14 is not online. enser14
Joined: 28 Oct 2012
Total Posts: 258
19 Oct 2015 01:35 PM
What do you mean? am i missing somthing that is needed before the end?
Report Abuse
Blackstride is not online. Blackstride
Joined: 19 Nov 2010
Total Posts: 8133
19 Oct 2015 01:39 PM
instead of remove, try destroy()
Report Abuse
Solotaire is not online. Solotaire
Joined: 30 Jul 2009
Total Posts: 30356
19 Oct 2015 01:40 PM
part:Destroy()
or
script.Parent:Destroy()

it's not clear which one you want
Report Abuse
metr0idhunterx is not online. metr0idhunterx
Joined: 15 Feb 2011
Total Posts: 257
19 Oct 2015 01:41 PM
function ontouched(part)
local d = part.Parent:GetChildren()
for i=1, #d do
if (d[i].Name == "nail") or (d[i].Name == "WeldPart" then
d[i]:remove()
end
end
end

script.Parent.Touched:connect(ontouched)

Your script isn't finding what is being removed. Remove is a tricky function, you have to specify what it's removing with :remove() rather than write it as then remove.

Report Abuse
enser14 is not online. enser14
Joined: 28 Oct 2012
Total Posts: 258
19 Oct 2015 01:50 PM
ah thanks.
Report Abuse
enser14 is not online. enser14
Joined: 28 Oct 2012
Total Posts: 258
19 Oct 2015 01:51 PM
but does this do if part named nail or weldpart remove or just removes those parts no matter what hits brick that triggers the script.
Report Abuse
metr0idhunterx is not online. metr0idhunterx
Joined: 15 Feb 2011
Total Posts: 257
19 Oct 2015 02:06 PM
The line: local d = hit.Parent:GetChildren() makes it so that the hit is whatever part comes in contact with the part the script is inserted in, and .Parent is the model the nail/WeldPart is inserted into (say your Character).

Example:

> Player1 (model)
nail
weldpart
head
torso
leg1
leg2
arm1
arm2

Report Abuse
metr0idhunterx is not online. metr0idhunterx
Joined: 15 Feb 2011
Total Posts: 257
19 Oct 2015 02:08 PM
Basically, whatever touches the part, if it has a part or object named WeldPart/nail inserted in it, they will be deleted.

It's comparable to a hat remover.
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Game Design
   
 
   
  • 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