Cyerwyn
|
  |
| Joined: 09 Mar 2013 |
| Total Posts: 3442 |
|
|
| 14 Nov 2015 10:17 AM |
It won't work, but it worked 10 minutes ago
weak = game.Workspace.weak
for i = 1, 1000 do weak.BrickColor = BrickColor.Random() end
It changes once and doesnt change again. Any ideas?
They say after your death, your brain is still active for 7 minutes. In those 7 minutes, you relive your entire life. What if you're in those 7 minutes? |
|
|
| Report Abuse |
|
|
|
| 14 Nov 2015 10:19 AM |
| You need a wait() in there, or it will break. |
|
|
| Report Abuse |
|
|
|
| 14 Nov 2015 10:21 AM |
What error are you getting? Also, your title differs from the code - you have 1, 10 in the title and 1, 1000 in the loop |
|
|
| Report Abuse |
|
|
|
| 14 Nov 2015 10:21 AM |
After the "for i=1, 1000 do" on the next line place a wait like this:
for i=1, 1000 do wait(1) weak.BrickColor = BrickColor.Random()
end |
|
|
| Report Abuse |
|
|
|
| 14 Nov 2015 10:21 AM |
| So if you have 1,1000 and you need that to happed in 100 seconds then put wait(0.1). But if you want it to take 10 seconds use wait(0.01) |
|
|
| Report Abuse |
|
|
Cyerwyn
|
  |
| Joined: 09 Mar 2013 |
| Total Posts: 3442 |
|
|
| 14 Nov 2015 10:21 AM |
Thank you guys
They say after your death, your brain is still active for 7 minutes. In those 7 minutes, you relive your entire life. What if you're in those 7 minutes? |
|
|
| Report Abuse |
|
|
cgjnm
|
  |
| Joined: 22 Dec 2011 |
| Total Posts: 2347 |
|
|
| 14 Nov 2015 10:22 AM |
| without a wait() it will just go to the very last one. Because w/o a wait() it does everything in no time at all. |
|
|
| Report Abuse |
|
|
|
| 14 Nov 2015 10:24 AM |
and if it does something that eats cpu, without a wait(), you'll game obvsly will crash
-wiki before u forum |
|
|
| Report Abuse |
|
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
|
| 14 Nov 2015 11:27 AM |
| OP the real answer is that it actually changes 1000 times, you just didn't see it because it happened too quickly. |
|
|
| Report Abuse |
|
|
Locard
|
  |
| Joined: 13 Apr 2014 |
| Total Posts: 3516 |
|
|
| 14 Nov 2015 11:33 AM |
| @mario The fastest wait() goes down to only 1/30 of a second, not 1/100 of a second. |
|
|
| Report Abuse |
|
|
| |
|
cgjnm
|
  |
| Joined: 22 Dec 2011 |
| Total Posts: 2347 |
|
|
| 24 Nov 2015 08:41 PM |
@Locard The fastest time to wait is roughly 1/60 of a second
while game:GetService("RunService").RenderStepped:wait() do
end |
|
|
| Report Abuse |
|
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
|
| 24 Nov 2015 09:43 PM |
That's not a "wait", that's just a yield until an event is invoked. The smallest "yield" would just be to not yield, or to do something useless which takes a minuscule amount of time to execute. In terms of _actually_ yielding, coroutine.yield() |
|
|
| Report Abuse |
|
|
lordrambo
|
  |
| Joined: 16 Jun 2009 |
| Total Posts: 20628 |
|
|
| 24 Nov 2015 09:50 PM |
| ew and he tried to do that in the condition, why do people still do that |
|
|
| Report Abuse |
|
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
|
| 24 Nov 2015 09:53 PM |
| Yeah I never got why people did that, like "while wait() do" or whatever. I think just gross. |
|
|
| Report Abuse |
|
|
|
| 24 Nov 2015 10:05 PM |
| It makes it faster so it evaluates wait() instead of wait() And true. |
|
|
| Report Abuse |
|
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
|
| 24 Nov 2015 10:08 PM |
| Uh no, "while wait() do" is actually less efficient because "while true do" is going to be optimized, there is no evaluation of "true". |
|
|
| Report Abuse |
|
|
|
| 24 Nov 2015 10:11 PM |
| Even if that were true, less code = slightly faster. And wait is going to be evaluated either way |
|
|
| Report Abuse |
|
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
|
| 24 Nov 2015 10:12 PM |
"less code = slightly faster" not even close. And no, the values returned from the wait has to be evaluated. If you are going to keep on arguing with me when you don't even know how it compiles then you must be pretty dumb. The least you could do is think. |
|
|
| Report Abuse |
|
|
lordrambo
|
  |
| Joined: 16 Jun 2009 |
| Total Posts: 20628 |
|
|
| 25 Nov 2015 10:11 AM |
| looks like heavylifterman92 doesn't understand the compile-time and run-time, and anyone who cares about compile-time is bad |
|
|
| Report Abuse |
|
|
Link5659
|
  |
| Joined: 04 Jun 2012 |
| Total Posts: 4525 |
|
| |
|
|
| 25 Nov 2015 10:30 AM |
| Lol except Lua doesn't compile. |
|
|
| Report Abuse |
|
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
|
| 25 Nov 2015 01:18 PM |
| Except that you're stupid because it compiles into an intermediate form because interpreting bytecode is far easier, faster, and smaller than interpreting source coded directly. |
|
|
| Report Abuse |
|
|
jody7777
|
  |
| Joined: 22 Feb 2009 |
| Total Posts: 1343 |
|
|
| 25 Nov 2015 01:38 PM |
lua is compiled down to byte-code like java, then that is interpeted by the lua virtual machine
less code = -0.00000001 seconds
FOR THE CAUSE |
|
|
| Report Abuse |
|
|
cntkillme
|
  |
| Joined: 07 Apr 2008 |
| Total Posts: 44956 |
|
|
| 25 Nov 2015 01:41 PM |
'less code = -0.00000001 seconds' no.
At compile-time, maybe. In which case if you're using such a stupid way to measure it because it's only done once, then don't use local variables, don't make variables with names larger than 1 character, don't use tabs, etc.
Oh wait, you guys are stupid for thinking more code = slower. |
|
|
| Report Abuse |
|
|