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 » Scripting Helpers
Home Search
 

Re: How would you go about this?

Previous Thread :: Next Thread 
DarkTetsuo is not online. DarkTetsuo
Joined: 05 Jun 2008
Total Posts: 22
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 is not online. 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
DarkTetsuo is not online. DarkTetsuo
Joined: 05 Jun 2008
Total Posts: 22
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
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • 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