Dodeca
|
  |
| Joined: 11 Sep 2011 |
| Total Posts: 13649 |
|
|
| 20 Jan 2016 01:11 AM |
local connected = script.Parent:GetConnectedParts()
for i=1, #connected do if not connected[i]:FindFirstChild("Burn") then local brick = connected[i] local burnscript = script:Clone() brick.BrickColor = BrickColor.new("Really black") Instance.new("Fire", brick) burnscript.Parent = connected[i] wait(2) end end
Works fine, but i've noticed that it doesn't infect the closest parts first.
|
|
|
| Report Abuse |
|
|
Soybeen
|
  |
| Joined: 17 Feb 2010 |
| Total Posts: 21462 |
|
|
| 20 Jan 2016 01:17 AM |
Alternatively, instead of using the :GetConnectedParts() method of contagion, you could use a region or ray-based detection.
|
|
|
| Report Abuse |
|
|
Soybeen
|
  |
| Joined: 17 Feb 2010 |
| Total Posts: 21462 |
|
|
| 20 Jan 2016 01:18 AM |
It would be cool if there was a way to tell if the part was DIRECTLY connected to the original part.
Maybe there is, I'd have to wiki it.
|
|
|
| Report Abuse |
|
|
Soybeen
|
  |
| Joined: 17 Feb 2010 |
| Total Posts: 21462 |
|
|
| 20 Jan 2016 01:20 AM |
Hah! I did. Read this: http://wiki.roblox.com/index.php?title=API:Class/BasePart/GetConnectedParts
Just don't make it recursive. \ (•◡•) /
|
|
|
| Report Abuse |
|
|
Dodeca
|
  |
| Joined: 11 Sep 2011 |
| Total Posts: 13649 |
|
|
| 20 Jan 2016 01:20 AM |
There's :GetConnectedParts() and :GetTouchingParts()
Also @Soybeen,
if connected[i]:FindFirstChild("Burn") ~= nil and connected[i].Name ~= "Baseplate" then In output it's saying "startScript re-entrancy has exceeded 3", I'm trying to give commands if the "Burn" script isn't a child nor is the part named "Baseplate"
|
|
|
| Report Abuse |
|
|
Dodeca
|
  |
| Joined: 11 Sep 2011 |
| Total Posts: 13649 |
|
|
| 20 Jan 2016 01:21 AM |
Oh sweet, I didn't even look at the recursive part.
|
|
|
| Report Abuse |
|
|
Soybeen
|
  |
| Joined: 17 Feb 2010 |
| Total Posts: 21462 |
|
|
| 20 Jan 2016 01:24 AM |
That error is actually a security mechanism implemented by ROBLOX to stop mass cloning. It reads:
"This is caused when ROBLOX tries to prevent scripts from mass-cloning themselves. If there is a script that has cloned itself, that clones that, and clones even that. Roblox picks up on this and stops it. Somehow, your script is being cloned over and over again."
|
|
|
| Report Abuse |
|
|
Soybeen
|
  |
| Joined: 17 Feb 2010 |
| Total Posts: 21462 |
|
|
| 20 Jan 2016 01:25 AM |
That was just a summary of the error by someone on the old ScriptingHelpers webiste; it probably means something different for you.
|
|
|
| Report Abuse |
|
|
Dodeca
|
  |
| Joined: 11 Sep 2011 |
| Total Posts: 13649 |
|
|
| 20 Jan 2016 01:26 AM |
It's working all fine though, but I only get the error when I only check for two conditions. When checking for one, it works.
|
|
|
| Report Abuse |
|
|
Soybeen
|
  |
| Joined: 17 Feb 2010 |
| Total Posts: 21462 |
|
|
| 20 Jan 2016 01:29 AM |
Cool so you can just check for one at a time
|
|
|
| Report Abuse |
|
|
Dodeca
|
  |
| Joined: 11 Sep 2011 |
| Total Posts: 13649 |
|
|
| 20 Jan 2016 01:30 AM |
Yea, I guess i'll just check if it's a baseplate/certain part.
|
|
|
| Report Abuse |
|
|