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: Touched Trick

Previous Thread :: Next Thread 
8SunTzu8 is not online. 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 is not online. 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
ultralegomaster5096 is not online. ultralegomaster5096
Joined: 17 Jan 2011
Total Posts: 4351
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 is not online. 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 is not online. 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
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