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: Fire spread script

Previous Thread :: Next Thread 
Dodeca is not online. 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 is online. 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 is online. 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 is online. 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 is not online. 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 is not online. 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 is online. 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 is online. 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 is not online. 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 is online. 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 is not online. 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
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