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: Deleting brick "M" onTouched

Previous Thread :: Next Thread 
doneyes is online. doneyes
Joined: 21 Mar 2008
Total Posts: 3466
28 Jun 2012 09:50 AM
I'm trying to make a script that deletes any brick named "M" that touches it at any time. Here is what I've got. I'm not good with onTouched so I need some help.


M = script.Parent.Parent.M

function onTouched(hit)
if M.Name == "M" then
M:Remove()
end

script.Parent.Touched:connect(onTouched)
Report Abuse
AlbinoDerpasaurusRex is not online. AlbinoDerpasaurusRex
Joined: 09 Jun 2012
Total Posts: 248
28 Jun 2012 10:01 AM
[ Content Deleted ]
Report Abuse
RoAnt is not online. RoAnt
Joined: 14 Jul 2008
Total Posts: 16794
28 Jun 2012 10:15 AM
local M = script.Parent.Parent.M

M.Touched:connect(function(hit)
if hit.Name == "M" then
hit:Remove()
end
end)


I'm not sure what you want... so here.
This basically delete any brick that touch the variable M.
But! The brick has to be named 'M'
Report Abuse
doneyes is online. doneyes
Joined: 21 Mar 2008
Total Posts: 3466
28 Jun 2012 10:20 AM
It still isn't working. I really cant figure this out.
Report Abuse
MrNicNac is not online. MrNicNac
Joined: 29 Aug 2008
Total Posts: 26567
28 Jun 2012 10:20 AM
M = script.Parent.Parent.M

function onTouched(hit)
if M.Name == "M" then
M:Remove()
end
end

script.Parent.Touched:connect(onTouched)
Report Abuse
KnightmareXD is not online. KnightmareXD
Joined: 14 Jul 2009
Total Posts: 11189
28 Jun 2012 10:40 AM
script.Parent.Touched:connect(function(hit)
if not hit.Name == "M" then return end
hit:Destroy()
end)

This will destroy any bricks named "M" that touched this script's parent. Hopefully that's what you wanted...

> † KMXD †
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