|
| 08 Oct 2014 03:46 PM |
So I need to check the entire workspace for what parts are at certain coordinates. What I have so far if a script that supplies the coordinated in the form of a vector3value in a model that I use as a list of coordinates to check. I also have a formula to tell if something is in the range of a coordinate. What I need is a script to: go through the list of coordinates and go through every part in the workspace and run it through my formula to see if it is at the coordinate. then it can remove the part if it named "wood" or if it is a player it should be killed. Any ideas? The way I have it now takes way too long for it to check every part in the workspace. Is there any other way to do this? Thanks if you can help even the slightest! -Jordan
|
|
|
| Report Abuse |
|
|
lordrambo
|
  |
| Joined: 16 Jun 2009 |
| Total Posts: 20628 |
|
|
| 08 Oct 2014 03:51 PM |
for i, v in pairs(workspace:GetChildren()) do if v:IsA("BasePart") then for index, coordinate in pairs(coordinates) do if v.Position == coordinate then if v.Name == "wood" then v:Destroy() end if game.Players:GetPlayerFromCharacter(v) then v.Humanoid.Health = 0 end end end
I just wrote this here so you'll have to check if I made any syntax errors or not.
|
|
|
| Report Abuse |
|
|
|
| 08 Oct 2014 03:56 PM |
| I tried using "for i, v in pairs(workspace:GetChildren()) do" in my original script but it gives me a stack overflow when searching and if I add a wait() to it then it takes waaay to long. Any other creative ideas? |
|
|
| Report Abuse |
|
|