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: repeat loop is ending early

Previous Thread :: Next Thread 
ColdSmoke is not online. ColdSmoke
Joined: 02 Jan 2012
Total Posts: 5784
01 Jan 2014 12:59 AM
So the repeat works, but after a few seconds it just stops and the for i statement doesn't continue, why?

local Humanoid = script.Parent.Humanoid
local Nodes = script.Parent.Parent.Nodes

while wait() do
numn = Nodes:GetChildren()
for i = 1,#numn do
Humanoid:MoveTo(numn[i].Position, numn[i])
repeat wait()
until script.Parent.Torso.Position.x < numn[i].Position.x+5 and script.Parent.Torso.Position.x > numn[i].Position.x-5 and script.Parent.Torso.Position.z < numn[i].Position.z+5 and script.Parent.Torso.Position.z > numn[i].Position.z-5
end
end
Report Abuse
ColdSmoke is not online. ColdSmoke
Joined: 02 Jan 2012
Total Posts: 5784
01 Jan 2014 09:37 AM
bring up my post
Report Abuse
wazap is not online. wazap
Joined: 29 Jun 2007
Total Posts: 23234
01 Jan 2014 09:59 AM
Capital X and capital Z I think
Report Abuse
ColdSmoke is not online. ColdSmoke
Joined: 02 Jan 2012
Total Posts: 5784
01 Jan 2014 10:01 AM
thats not an issue

it repeats for like, 5 seconds then stops, and if it hit the node by that time its fine and goes to the next i and the next repeat loop
Report Abuse
ColdSmoke is not online. ColdSmoke
Joined: 02 Jan 2012
Total Posts: 5784
01 Jan 2014 10:02 AM
http://www.roblox.com/RPG-place?id=139339127

ill show whoever wants to come
Report Abuse
ColdSmoke is not online. ColdSmoke
Joined: 02 Jan 2012
Total Posts: 5784
01 Jan 2014 11:49 AM
bump

Report Abuse
ColdSmoke is not online. ColdSmoke
Joined: 02 Jan 2012
Total Posts: 5784
01 Jan 2014 01:26 PM
why doesnt anyone know whats going on


what is this communism
Report Abuse
Thaeh is not online. Thaeh
Joined: 05 Feb 2011
Total Posts: 7685
01 Jan 2014 01:32 PM
could you explain what this is supossed to do? you use a fast repeat for every node, seems like there is a logic error
Report Abuse
ColdSmoke is not online. ColdSmoke
Joined: 02 Jan 2012
Total Posts: 5784
01 Jan 2014 01:36 PM
It sends the humanoid to walk to a node, and once it is within a 5x5 perimeter of the node its should walk to the next one
Report Abuse
Thaeh is not online. Thaeh
Joined: 05 Feb 2011
Total Posts: 7685
01 Jan 2014 01:51 PM
it looks too confusing so i won't even try.
i think VectorTo3DRegion or something is better for that, search it up
Report Abuse
wazap is not online. wazap
Joined: 29 Jun 2007
Total Posts: 23234
01 Jan 2014 02:10 PM
I agree, FindFpartsInRegion3 might be better..
Report Abuse
Thaeh is not online. Thaeh
Joined: 05 Feb 2011
Total Posts: 7685
01 Jan 2014 02:12 PM
all methods and functions built-in roblox are hundreds of times more efficent than user-made ones. that was the case for raycasting.
Report Abuse
ColdSmoke is not online. ColdSmoke
Joined: 02 Jan 2012
Total Posts: 5784
01 Jan 2014 03:41 PM
well the nodes are just points for multiple humanoids to reference, I'm not really sure how would implement that, pluse with the huge amount of nodes i plan to have. All this is is simply findning the torso relation to the node, i could probably use magnitude as a better solution
Report Abuse
ColdSmoke is not online. ColdSmoke
Joined: 02 Jan 2012
Total Posts: 5784
01 Jan 2014 05:43 PM
ok I switched it to magnitude and as expected, nothing happened. i'm telling you for some reason after a certain number of repeats it just stops for some reason ..
Report Abuse
ColdSmoke is not online. ColdSmoke
Joined: 02 Jan 2012
Total Posts: 5784
01 Jan 2014 05:44 PM
new code btw

local Humanoid = script.Parent.Humanoid
local Nodes = script.Parent.Parent.Nodes

while wait() do
numn = Nodes:GetChildren()
for i = 1,#numn do
Humanoid:MoveTo(numn[i].Position, numn[i])
repeat wait() magnitude = (script.Parent.Torso.Position-numn[i].Position).magnitude
until math.abs(magnitude) < 6
end
end
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