8SunTzu8
|
  |
| Joined: 30 Sep 2011 |
| Total Posts: 8199 |
|
|
| 19 Jan 2013 09:14 AM |
Basically, this is the "structure" of my script, not the actual script.
function Capture(hit) local human = hit.Parent:FindFirstChild("Humanoid") if human then local player = game.Players:FindFirstChild(hit.Parent) if player then local CorrespondingValue --Target local GUI --Target ChangeFlagAndTeams() end end end
game.Capture1.Touched:connect(Capture) game.Capture2.Touched:connect(Capture) game.Capture3.Touched:connect(Capture)
My issue? I want to connect the touching of 3 parts to one single function, so that I don't need to copy and paste, and slightly edit, each part's respective function. It's to save space and organize things nicer, along with making this system much easier to expand. It's a complicated capture system integrated with a checkpoint based spawning system.
I need to get the part that is being touched, so that I can refer to it's specific values, which relate to the checkpoint spawning system. It's how each capture point differs. The two values marked by "--Target" will basically point to "CapturePart.Parent.Value" or "CapturePart.Parent.GUI". Does anyone know how to accomplish this, or do I need to explain it differently? I can't think of a way at the moment.
"If you want to become a Developer or Innovator for CSA, contact me." |
|
|
| Report Abuse |
|
|
8SunTzu8
|
  |
| Joined: 30 Sep 2011 |
| Total Posts: 8199 |
|
|
| 19 Jan 2013 09:26 AM |
Does anyone have any ideas? (This floodcheck is insanely long, long, long, long, long, long, long, loooooooooooooooooooooooooooooooooong).
"If you want to become a Developer or Innovator for CSA, contact me." |
|
|
| Report Abuse |
|
|
|
| 19 Jan 2013 09:42 AM |
| On function fire, check the magnitude to determine the closest part to the touching part, and assume that's the hit brick? Depends on how close together the parts are. |
|
|
| Report Abuse |
|
|
8SunTzu8
|
  |
| Joined: 30 Sep 2011 |
| Total Posts: 8199 |
|
|
| 19 Jan 2013 09:47 AM |
Yeah, that's not something that will work well. I could try finding a part with part of its name being "Capture". (Capture1, Capture2, and Capture3 are the names, so I only check for parts with a similar name).
"If you want to become a Developer or Innovator for CSA, contact me." |
|
|
| Report Abuse |
|
|
8SunTzu8
|
  |
| Joined: 30 Sep 2011 |
| Total Posts: 8199 |
|
|
| 19 Jan 2013 09:49 AM |
Wait, I could just find the magnitudes between the player's character and the capture points on the map. Then I select the shortest one. (Like under 5 or 10).
The points are all far away. Thanks for the help.
"If you want to become a Developer or Innovator for CSA, contact me." |
|
|
| Report Abuse |
|
|