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
 

Some quick help with a Touched script

Previous Thread :: Next Thread 
badgraphix is not online. badgraphix
Joined: 26 Nov 2007
Total Posts: 22800
16 Nov 2014 12:49 AM
At the bottom of my script I have this



group = script.Parent.Climb:GetChildren()

for i = 1, #group do
group[i].Touched:connect(onTouched)
end



Now, that works as intended--whenever any of the children in script.Parent.Climb get touched it goes to the main part of the script.

This is my problem--I want to reference the specific part that was touched, but using group[i] won't work so I don't what to do.
Report Abuse
Joshua7851 is not online. Joshua7851
Joined: 18 Nov 2012
Total Posts: 210
16 Nov 2014 01:38 AM
in the ontouched script, make it so it will take note of the block it was touched on, like if you are making a brick transparent, so instead of part.Transparancy, do Part.Name.
Report Abuse
badgraphix is not online. badgraphix
Joined: 26 Nov 2007
Total Posts: 22800
16 Nov 2014 02:21 AM
"in the ontouched script, make it so it will take note of the block it was touched on"

That's what I'm asking how to do.
Report Abuse
wazap is not online. wazap
Joined: 29 Jun 2007
Total Posts: 23234
16 Nov 2014 02:37 AM
Change onTouched to this


function onTouched(hit, part)

group = script.Parent.Climb:GetChildren()

for i = 1, #group do
group[i].Touched:connect(function(hit) onTouched(hit, group[i]) end)
end

Now the reference to the part that was touched in the onTouched function would be called part

The potato speaks the truth
Report Abuse
badgraphix is not online. badgraphix
Joined: 26 Nov 2007
Total Posts: 22800
16 Nov 2014 02:44 AM
Thanks.
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