AstroCode
|
  |
| Joined: 09 Oct 2009 |
| Total Posts: 1122 |
|
|
| 20 Sep 2015 09:20 AM |
Which is faster:
if part.Parent:FindFirstChild("Something") then part.Parent.Something:Destroy() end
Or
pcall(function() part.Parent.Something:Destroy() end) |
|
|
| Report Abuse |
|
|
|
| 20 Sep 2015 09:22 AM |
| Use the first, pcall is very inefficient when used there |
|
|
| Report Abuse |
|
|
|
| 20 Sep 2015 09:22 AM |
Neither
pcall(game.Players.Destroy, part.Parent.Something) |
|
|
| Report Abuse |
|
|
AstroCode
|
  |
| Joined: 09 Oct 2009 |
| Total Posts: 1122 |
|
|
| 20 Sep 2015 09:28 AM |
@TickerOfTime
What are you talking about? I didn't say anything about game.Players |
|
|
| Report Abuse |
|
|
|
| 20 Sep 2015 09:39 AM |
| Ik, but Destroy is a method. Calling it from an existing object is faster than making a new function for pcall, albeit marginally |
|
|
| Report Abuse |
|
|
|
| 20 Sep 2015 09:40 AM |
| First one is more efficient, use pcall when it's needed (which is typically never, unless you're using it for a hacky solution). |
|
|
| Report Abuse |
|
|
|
| 20 Sep 2015 09:41 AM |
Also, if you wanted to make your if statement more efficient just do: local obj = place:FindFirstChild("name"); if obj then obj:Destroy(); end |
|
|
| Report Abuse |
|
|