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
We use cookies to offer you a better experience. By using Roblox.com, you are agreeing to our Privacy and Cookie Policy.
   
ROBLOX Forum » Game Creation and Development » Scripting Helpers
Home Search
 

Re: Help.

Previous Thread :: Next Thread 
Termblue101 is not online. Termblue101
Joined: 07 Jun 2012
Total Posts: 3559
15 Jun 2013 01:37 PM
[ Content Deleted ]
Report Abuse
zakary99 is not online. zakary99
Joined: 19 Jan 2010
Total Posts: 1095
15 Jun 2013 05:25 PM
local broken = false
while true do
if broken == false then
print("Lol")
end
wait()
end

function break()
broken = true
end
break()
Report Abuse
Termblue101 is not online. Termblue101
Joined: 07 Jun 2012
Total Posts: 3559
15 Jun 2013 08:27 PM
[ Content Deleted ]
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
15 Jun 2013 08:29 PM
breaknow = false

function Func()
while true do
print('lol')
wait()
if breaknow then break end
end
end

function DoBreak()
breaknow = true
end
Report Abuse
Termblue101 is not online. Termblue101
Joined: 07 Jun 2012
Total Posts: 3559
15 Jun 2013 08:33 PM
[ Content Deleted ]
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
15 Jun 2013 08:34 PM
You would have to call stoploop, which can't be called as long as the loop is actually running, use a coroutine
Report Abuse
Termblue101 is not online. Termblue101
Joined: 07 Jun 2012
Total Posts: 3559
15 Jun 2013 08:36 PM
[ Content Deleted ]
Report Abuse
Termblue101 is not online. Termblue101
Joined: 07 Jun 2012
Total Posts: 3559
15 Jun 2013 08:37 PM
[ Content Deleted ]
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
15 Jun 2013 08:37 PM
Think of it as a "script within a script" or a "thread"

If you do:

while true do
--code
end

--code2

code2 will not run unless the loop is stopped, however if you put the loop in a coroutine, code2 will run at the same time.

coroutine.resume(coroutine.create(function()
while true do
--code
end))

--code2
Report Abuse
Termblue101 is not online. Termblue101
Joined: 07 Jun 2012
Total Posts: 3559
15 Jun 2013 08:41 PM
[ Content Deleted ]
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
15 Jun 2013 08:43 PM
No, remove the first part and second part
"while true do
camera.CoordinateFrame = CFrame.new(target.Position)
* CFrame.Angles(0, angle, 0)
* CFrame.new(0, 0, -5)
angle = angle + math.rad(1)
end

function stoploop()
breaknow = true
end"

and keep the bottom part
Report Abuse
Termblue101 is not online. Termblue101
Joined: 07 Jun 2012
Total Posts: 3559
15 Jun 2013 08:53 PM
[ Content Deleted ]
Report Abuse
Termblue101 is not online. Termblue101
Joined: 07 Jun 2012
Total Posts: 3559
15 Jun 2013 08:53 PM
[ Content Deleted ]
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
15 Jun 2013 08:54 PM
Add a:
breaknow = false
Over the corooutine

and add another parenthesis after the "end)" so it's "end))"

And anytime you want to stop the loop, run stoploop()
also, add a wait in the loop so you don't crash
Report Abuse
Termblue101 is not online. Termblue101
Joined: 07 Jun 2012
Total Posts: 3559
15 Jun 2013 08:56 PM
[ Content Deleted ]
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