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: Humanoid:MoveTo - Question

Previous Thread :: Next Thread 
brayden99 is not online. brayden99
Joined: 30 Sep 2007
Total Posts: 1243
03 Nov 2013 01:14 AM
while wait() do
Humanoid:MoveTo(Vector3.new(284,0,0),Workspace['Point1'])
end

Is there anyway to detect when the humanoid is at that position? 284 studs away from Point1.
Report Abuse
Conmiro is not online. Conmiro
Joined: 13 Oct 2008
Total Posts: 3393
03 Nov 2013 01:17 AM
I'm not sure why you are using while wait() do for this but...


Is Point1 a position or part?

let's say:

Point1 = part
Humanoid:MoveTo(Point1.Position + Vector3.new(284,0,0))
Report Abuse
brayden99 is not online. brayden99
Joined: 30 Sep 2007
Total Posts: 1243
03 Nov 2013 01:18 AM
Character = script.Parent
Humanoid = Character['Humanoid']
Point1 = Workspace['Point1']

while wait() do
Humanoid:MoveTo(Vector3.new(284,0,0),Workspace['Point1'])
end
Report Abuse
Conmiro is not online. Conmiro
Joined: 13 Oct 2008
Total Posts: 3393
03 Nov 2013 01:20 AM
Character = script.Parent
Humanoid = Character['Humanoid']
Point1 = Workspace['Point1']

while wait() do
Humanoid:MoveTo(Point1.Position + Vector3.new(284,0,0))
end

Report Abuse
Conmiro is not online. Conmiro
Joined: 13 Oct 2008
Total Posts: 3393
03 Nov 2013 01:24 AM
You say you want to detect when the humanoid is at that position..

Check to see when the humanoid collides with Point1 part using an onTouched function. I can help with that if you need. There's more complicated methods using magnitudes but the method I know uses a lot of scripting cycles.
Report Abuse
brayden99 is not online. brayden99
Joined: 30 Sep 2007
Total Posts: 1243
03 Nov 2013 01:24 AM
01:24:21.077 - Argument 2 missing or nil
01:24:21.078 - Script 'Workspace.Player.Script', Line 6
01:24:21.078 - stack end
Report Abuse
brayden99 is not online. brayden99
Joined: 30 Sep 2007
Total Posts: 1243
03 Nov 2013 01:25 AM
Yeah okay.
Report Abuse
lordrambo is not online. lordrambo
Joined: 16 Jun 2009
Total Posts: 20628
03 Nov 2013 01:26 AM
Character = script.Parent
Humanoid = Character['Humanoid']
Vec = Vector3.new(284,0,0)

--this doesn't require a loop
Humanoid:MoveTo(Vec,workspace.Terrain)--workspace.Terrain is valid for the second argument

while (Character.Torso.Position - Vec).magnitude > 5 then -- may need to alter this a bit, but this should suffice
wait()
end

--[[do the rest of your code here
Also note that the second argument of MoveTo serves no purpose other than indicating that the character should walk itself there rather than teleport. workspace.Terrain will always exist, so I find it most efficient.
Report Abuse
lordrambo is not online. lordrambo
Joined: 16 Jun 2009
Total Posts: 20628
03 Nov 2013 01:27 AM
I should have ended that long comment with "]]". In ROBLOX it won't cause any errors really, as long as no code is under it, but in standard lua that wouldn't be acceptable. You'll probably delete it anyways.
Report Abuse
Conmiro is not online. Conmiro
Joined: 13 Oct 2008
Total Posts: 3393
03 Nov 2013 01:28 AM
Character = script.Parent
Humanoid = Character['Humanoid']
Point1 = Workspace['Point1']


pos = Point1.Position + Vector3.new(284,0,0)
print(pos)
Humanoid:MoveTo(pos, Point1)
Report Abuse
Conmiro is not online. Conmiro
Joined: 13 Oct 2008
Total Posts: 3393
03 Nov 2013 01:31 AM
Character = script.Parent
Humanoid = Character['Humanoid']
Point1 = Workspace.Point1
Vec = Point1.Position + Vector3.new(284,0,0)

--this doesn't require a loop
Humanoid:MoveTo(Vec,workspace.Terrain)--workspace.Terrain is valid for the second argument

while (Character.Torso.Position - Vec).magnitude > 5 then -- may need to alter this a bit, but this should suffice
wait()
end

--[[do the rest of your code here
Also note that the second argument of MoveTo serves no purpose other than indicating that the character should walk itself there rather than teleport. workspace.Terrain will always exist, so I find it most efficient.
Report Abuse
brayden99 is not online. brayden99
Joined: 30 Sep 2007
Total Posts: 1243
03 Nov 2013 01:34 AM
Thanks for the help homies!
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