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 do I make heat seeking bricks?

Previous Thread :: Next Thread 
destroyer068 is not online. destroyer068
Joined: 28 Nov 2011
Total Posts: 25
24 Mar 2012 05:11 PM
How do I make a script that will make a brick go to the closest player?
Report Abuse
ggfunny1234 is not online. ggfunny1234
Joined: 09 Jul 2010
Total Posts: 3432
24 Mar 2012 05:11 PM
Insert>Object>Script

-Type code-

VOILA!
Report Abuse
destroyer068 is not online. destroyer068
Joined: 28 Nov 2011
Total Posts: 25
25 Mar 2012 12:16 PM
I meant what is the code for it.
Report Abuse
dmjoe is not online. dmjoe
Joined: 01 May 2009
Total Posts: 2387
25 Mar 2012 12:23 PM
No requests on this forum.

~According to astronomy, when you wish upon a star; you are actually a few million years late. The star is dead. Just like your dreams.~
Report Abuse
DragonFang1 is not online. DragonFang1
Joined: 02 Apr 2009
Total Posts: 1068
25 Mar 2012 12:25 PM
p=game.Players:GetChildren()

function findNearestHead()
local lastpos=99999
for i=1,#p do
if (script .Parent.Position-p[i].Character.Head.Position).magnitude < lastpos then
lastpos=p[i].Character.Head.Position
end
end
return lastpos
end

findNearestHead()--this give you the position of Nearest Head
Report Abuse
destroyer068 is not online. destroyer068
Joined: 28 Nov 2011
Total Posts: 25
25 Mar 2012 04:13 PM
I don't know how to use DragonFang's script so I created my own except all it does is make the brick go to the center of the map

game.Workspace.brick.RocketPropulsion.Target = game.Workspace:findFirstChild("Torso", true)
game.Workspace.brick.RocketPropulsion:Fire()
Report Abuse
DragonFang1 is not online. DragonFang1
Joined: 02 Apr 2009
Total Posts: 1068
26 Mar 2012 04:40 AM
p=game.Players:GetChildren()

function findNearestHead()
local lastpos=Instance.new("Part")
lastpos.Position=Vector3.new(9999999,999999,9999999)
for i=1,#p do
if (script .Parent.Position-p[i].Character.Head.Position).magnitude < (script .Parent.Position-lastpos.Position).magnitude then
lastpos=p[i].Character.Head
end
end
return lastpos
end

game.Workspace.brick.RocketPropulsion.Target = findNearestHead()game.Workspace.brick.RocketPropulsion:Fire()
Report Abuse
destroyer068 is not online. destroyer068
Joined: 28 Nov 2011
Total Posts: 25
26 Mar 2012 07:24 PM
It doesn't work. D:
Report Abuse
DragonFang1 is not online. DragonFang1
Joined: 02 Apr 2009
Total Posts: 1068
27 Mar 2012 08:01 AM
p=game.Players:GetChildren()

function findNearestHead()
local lastpos=p[1].Character.Head
for i=1,#p do
if (script .Parent.Position-p[i].Character.Head.Position).magnitude < (script .Parent.Position-lastpos.Position).magnitude then
lastpos=p[i].Character.Head
end
end
return lastpos
end

game.Workspace.brick.RocketPropulsion.Target = findNearestHead()game.Workspace.brick.RocketPropulsion:Fire()
Report Abuse
DragonFang1 is not online. DragonFang1
Joined: 02 Apr 2009
Total Posts: 1068
27 Mar 2012 08:03 AM
if that didn't work too maybe you could post the errors.
Report Abuse
destroyer068 is not online. destroyer068
Joined: 28 Nov 2011
Total Posts: 25
27 Mar 2012 08:20 PM
What do you mean?
Report Abuse
DragonFang1 is not online. DragonFang1
Joined: 02 Apr 2009
Total Posts: 1068
28 Mar 2012 03:22 AM
means, test it :P
Report Abuse
destroyer068 is not online. destroyer068
Joined: 28 Nov 2011
Total Posts: 25
28 Mar 2012 06:23 PM
doesn't work
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