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: Loop

Previous Thread :: Next Thread 
Darkmist101 is not online. Darkmist101
Joined: 30 Jul 2010
Total Posts: 6208
05 Dec 2011 05:51 PM
Why does the code run,
even the StageL isn't "Red"

coroutine.resume(
coroutine.create(
function()
while StageL == "Red" do
wait()
Bot.AI:MoveTo(_G.Character.Torso.Position, _G.Character.Torso)
end
end
)
)
Report Abuse
blockoo is not online. blockoo
Joined: 08 Nov 2007
Total Posts: 17202
05 Dec 2011 05:54 PM
It may have something to do with coroutines running independent of the script, so it still sees StageL as "Red" even when it's not. Just a guess, though.
Report Abuse
Darkmist101 is not online. Darkmist101
Joined: 30 Jul 2010
Total Posts: 6208
05 Dec 2011 05:56 PM
I could see that as a possibility,
As "StageL" only changes when another event becomes active.
Report Abuse
Darkmist101 is not online. Darkmist101
Joined: 30 Jul 2010
Total Posts: 6208
05 Dec 2011 05:59 PM
I don't know if this goes without asking,
but how could I fix it?

(Besides not running it from a coroutine)
Report Abuse
pwnedu46 is not online. pwnedu46
Joined: 23 May 2009
Total Posts: 7534
05 Dec 2011 06:02 PM
If StageL's value is not "Red" then it does not continue checking for the loop and it goes through the rest of the script. since there's nothing else after it, the coroutine's status becomes "dead."


----------
    ~ pwendu46, the unicorn ~
Report Abuse
Darkmist101 is not online. Darkmist101
Joined: 30 Jul 2010
Total Posts: 6208
05 Dec 2011 06:05 PM
Even though its dead,
the bot follows me :c
Report Abuse
blockoo is not online. blockoo
Joined: 08 Nov 2007
Total Posts: 17202
05 Dec 2011 06:07 PM
Make the initial value of StageL something other than "Red" and see what happens.
Report Abuse
Darkmist101 is not online. Darkmist101
Joined: 30 Jul 2010
Total Posts: 6208
05 Dec 2011 06:10 PM
He doesn't move.....

Odd how this happens,
but I realized I might as well fix this now and use a string value.
Report Abuse
Darkmist101 is not online. Darkmist101
Joined: 30 Jul 2010
Total Posts: 6208
05 Dec 2011 06:19 PM
?

Seems like when I get a good distance (100 studs+) he times out.....
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