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: Get part which triggered function.

Previous Thread :: Next Thread 
XXYOLOSWAGMATT is not online. XXYOLOSWAGMATT
Joined: 12 Feb 2016
Total Posts: 83
26 Jul 2017 04:27 PM
How would I get a part that triggered the function. I have 4 parts connected to a function but I want to be able to tell which part was touched.
Report Abuse
Karthon950 is not online. Karthon950
Joined: 30 May 2010
Total Posts: 75
26 Jul 2017 04:30 PM
Which function are you talking about? Is it an ontouched function?
The touched event sends the part that touched it as a parameter.
Report Abuse
DevJoas is not online. DevJoas
Joined: 17 Dec 2014
Total Posts: 627
26 Jul 2017 04:31 PM
http://wiki.roblox.com/index.php?title=API:Class/BasePart/Touched

Please read this.
Report Abuse
XXYOLOSWAGMATT is not online. XXYOLOSWAGMATT
Joined: 12 Feb 2016
Total Posts: 83
26 Jul 2017 04:36 PM
It is an ontouched function but I don't want the part of the player, I need to know what part/block was touched.
Report Abuse
Karthon950 is not online. Karthon950
Joined: 30 May 2010
Total Posts: 75
26 Jul 2017 04:41 PM
An ontouched function looks like this.

function onTouched(hit)
//do stuff
end
script.Parent.Touched:connect(onTouched)



In this script, there are two objects touching, the brick that the script is inside of, and the block that touched it.

Usually, you would put this script inside of say, a kill brick. In this case the kill brick would be script.Parent, and the part that touched it, probably the player's foot or head, would be 'hit'.
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