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 you make a script repeat without while true do

Previous Thread :: Next Thread 
TheDuckOfYork is not online. TheDuckOfYork
Joined: 07 Jan 2012
Total Posts: 6599
09 Nov 2013 09:41 PM
whenever I tr to use while true do, I get crashes.

repeat seems to need to have an end

anything that I can use?
Report Abuse
Jetta765214 is not online. Jetta765214
Joined: 22 Oct 2008
Total Posts: 1855
09 Nov 2013 09:44 PM
use:
while true do
wait()
end

or:

repeat
--stuff
until 1<2
Report Abuse
Iterations is not online. Iterations
Joined: 22 Jul 2013
Total Posts: 751
09 Nov 2013 10:06 PM
while wait(1/30) do end
--prevents any crashing


repeat
wait(1/30)
--code
until condition

function x()
wait(1/30)
--code
x()
end

idk
Report Abuse
AgentFirefox is not online. AgentFirefox
Top 100 Poster
Joined: 20 Jun 2008
Total Posts: 22404
09 Nov 2013 10:54 PM
When using infinite loops, you must use a wait() to pause the script.
Report Abuse
4444vince2 is not online. 4444vince2
Joined: 08 Nov 2008
Total Posts: 4880
09 Nov 2013 11:08 PM
You can always use two scripts and two value make one play if the value if active vice versa ( use onchanged function )( Also best value to use would be a bool value)

function OC1()
if script.Parent.S1.ON.Value == true then
script.Parent.S1.ON.Value = false
--Run a script... >_<
wait(0.25)-- Idk you may need a wait >_<
end

function OC2()
if script.Parent.S2.ON.Value == true then
script.Parent.S2.ON.Value = false
--Run a script... >_<
wait(0.25)-- Idk you may need a wait >_<
end

onchanged blah blah(S1)
onchanged blah blah(S2)

Just a rough example... :P
Report Abuse
4444vince2 is not online. 4444vince2
Joined: 08 Nov 2008
Total Posts: 4880
09 Nov 2013 11:10 PM
--Wow forgot to put after wait.. >_<

function OC1()
if script.Parent.S1.ON.Value == true then
script.Parent.S1.ON.Value = false
--Run a script... >_<
wait(0.25)-- Idk you may need a wait >_<
script.Parent.S2.ON.Value = true
end

function OC2()
if script.Parent.S2.ON.Value == true then
script.Parent.S2.ON.Value = false
--Run a script... >_<
wait(0.25)-- Idk you may need a wait >_<
script.Parent.S1.ON.Value = true
end

onchanged blah blah(S1)
onchanged blah blah(S2)
--fixed sorry about that >_<
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