gavie1234
|
  |
| Joined: 09 Feb 2011 |
| Total Posts: 177 |
|
|
| 22 Mar 2015 11:15 AM |
I am working on a project that involves making destructible environments. The problem is, when a building blows up, all the parts flying around make the engine lag hard. Is there a script that will automatically delete all loose parts?
Thanks, gavie1234
(posted earlier, making another post due to lack of replies) |
|
|
| Report Abuse |
|
|
gavie1234
|
  |
| Joined: 09 Feb 2011 |
| Total Posts: 177 |
|
| |
|
gavie1234
|
  |
| Joined: 09 Feb 2011 |
| Total Posts: 177 |
|
|
| 22 Mar 2015 11:26 AM |
if only scripting helpers was still up
|
|
|
| Report Abuse |
|
|
|
| 22 Mar 2015 11:35 AM |
if part.Anchored == false then part:Destroy() end
This what you mean? |
|
|
| Report Abuse |
|
|
gavie1234
|
  |
| Joined: 09 Feb 2011 |
| Total Posts: 177 |
|
|
| 22 Mar 2015 11:54 AM |
Kinda. The problem is, things can only be destroyed if they are unanchored (as far as I am concerned). Pretty much all of the buildings are automatically unanchored by a weld script. |
|
|
| Report Abuse |
|
|
|
| 22 Mar 2015 12:27 PM |
I don't understand what you want.
Are you asking for all unanchored bricks to be deleted?
|
|
|
| Report Abuse |
|
|
gavie1234
|
  |
| Joined: 09 Feb 2011 |
| Total Posts: 177 |
|
|
| 22 Mar 2015 01:20 PM |
I want all parts that are flying around to be deleted.
by the way, thanks to everyone helping me |
|
|
| Report Abuse |
|
|
|
| 22 Mar 2015 01:26 PM |
| Check if parts are moving, and then delete them. |
|
|
| Report Abuse |
|
|
gavie1234
|
  |
| Joined: 09 Feb 2011 |
| Total Posts: 177 |
|
|
| 22 Mar 2015 03:17 PM |
| I'm horrible at scripting, are there any scripts on the developer library for this? |
|
|
| Report Abuse |
|
|
|
| 22 Mar 2015 03:37 PM |
| I can't think of any way to do this without causing massive lag because of loops. |
|
|
| Report Abuse |
|
|
gavie1234
|
  |
| Joined: 09 Feb 2011 |
| Total Posts: 177 |
|
|
| 22 Mar 2015 07:04 PM |
| Anyone else got any other ideas? |
|
|
| Report Abuse |
|
|
gavie1234
|
  |
| Joined: 09 Feb 2011 |
| Total Posts: 177 |
|
| |
|
notfruit
|
  |
| Joined: 21 Sep 2012 |
| Total Posts: 1386 |
|
|
| 22 Mar 2015 08:24 PM |
| You can make the explosion delete all blocks within a certain radius. It's certainly more efficient than iterating through every part and seeing if it moved. |
|
|
| Report Abuse |
|
|
|
| 22 Mar 2015 08:28 PM |
Make an invisible "kill" brick.
Make the brick above a certain height, set transparency to 1.
Insert script inside brick.
Insert code to make it so that any bricks(NOT PART OF HUMANOID) will be :Destroy()[ed]. |
|
|
| Report Abuse |
|
|
gavie1234
|
  |
| Joined: 09 Feb 2011 |
| Total Posts: 177 |
|
|
| 23 Mar 2015 02:59 PM |
@above and @2 above very good ideas, can someone please make one of these happen? I'm bad with lua. |
|
|
| Report Abuse |
|
|
|
| 23 Mar 2015 04:42 PM |
For the invisible brick I would do Get Brick Set Brick Transparency to 1 Anchor It
Insert Script
script.Parent.Touched:connect(function(hit) if hit.Parent:FindFirstChild("Humanoid") then return end else hit:remove() end)
Idk if that would work cause I didn't try it and just typed it here. |
|
|
| Report Abuse |
|
|
gavie1234
|
  |
| Joined: 09 Feb 2011 |
| Total Posts: 177 |
|
|
| 23 Mar 2015 04:57 PM |
| Thanks for helping! I'll try it! |
|
|
| Report Abuse |
|
|
|
| 23 Mar 2015 05:06 PM |
script.Parent.Touched:connect(function(hit) if hit.Parent:FindFirstChild("Humanoid") then return else hit:Destroy() end end)
|
|
|
| Report Abuse |
|
|
gavie1234
|
  |
| Joined: 09 Feb 2011 |
| Total Posts: 177 |
|
|
| 23 Mar 2015 05:14 PM |
Hm, once I open Studio (im a bit busy now) I'll try this aswell! Thanks!
|
|
|
| Report Abuse |
|
|
|
| 23 Mar 2015 05:59 PM |
I'd probably do something like this
game.Workspace.ChildAdded:connect(function(child) if child:IsA("Explosion") then child.Hit:connect(function(part) part.CanCollide = false game.Debris:AddItem(part, 5) end) end end)
⬡ |
|
|
| Report Abuse |
|
|
gavie1234
|
  |
| Joined: 09 Feb 2011 |
| Total Posts: 177 |
|
|
| 24 Mar 2015 04:40 PM |
| Works awesome! Some of the parts don't disapear, but it's a minor problem that I can deal with! Thanks to everyone who helped me! <3 |
|
|
| Report Abuse |
|
|