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: Something else that I don't know how to do: Basic/Intermediate

Previous Thread :: Next Thread 
tydog88 is not online. tydog88
Joined: 27 Dec 2008
Total Posts: 384
18 Jul 2011 07:00 AM
Ok, just so you know, it's not so much that I don't know how to script as that I haven't scripted in this area before :-P

Current idea: Proximity
I found a script in free models to work off of, but it looks really inefficient. Well here it is:

Distance = (Ship:GetModelSize()/2)

function ScanGame()
Bricks = game.Workspace:GetChildren()
for i=1,#Bricks do
if Bricks[i]:IsA("Model") and Bricks[i]:findFirstChild("Humanoid") then
if (Bricks[i].Torso.Position - script.Parent.Position).magnitude < Distance then
--code
end
end
end
end
Report Abuse
tydog88 is not online. tydog88
Joined: 27 Dec 2008
Total Posts: 384
18 Jul 2011 07:33 AM
Bump
Report Abuse
Jetta765214 is not online. Jetta765214
Joined: 22 Oct 2008
Total Posts: 1855
18 Jul 2011 07:48 AM
Distance = (Ship:GetModelSize()/2)

function ScanGame()
Player = game.Players:getPlayers()
for i=1,#Player do
if game.Workspace:findFirstChild(Player[i]) ~= nil then
if (Player.Character.Torso.Position - script.Parent.Position).magnitude < Distance then
--code
end
end
end
end

this way it doesn't scan every brick just the characters torso
Report Abuse
tydog88 is not online. tydog88
Joined: 27 Dec 2008
Total Posts: 384
18 Jul 2011 08:35 AM
Thanks
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