|
| 17 Sep 2013 09:54 PM |
After an hour of narrowing down a script, I finally found what keeps causing my game to freeze upon testing:
for i=1,30 do RTime.Value=30-i wait(1) end
Why does it freeze? What can I do to fix it? |
|
|
| Report Abuse |
|
|
|
| 17 Sep 2013 09:56 PM |
| FYI, RTime is a defined variable, and is a NumberValue |
|
|
| Report Abuse |
|
|
Geomaster
|
  |
| Joined: 05 Jul 2008 |
| Total Posts: 1480 |
|
|
| 17 Sep 2013 09:57 PM |
Try this instead:
for i = 30, 1, -1 do RTime.Value = i wait(1) end
|
|
|
| Report Abuse |
|
|
| |
|
|
| 17 Sep 2013 09:59 PM |
| No output, as it freezes as soon as it opens a test server. |
|
|
| Report Abuse |
|
|
Geomaster
|
  |
| Joined: 05 Jul 2008 |
| Total Posts: 1480 |
|
|
| 17 Sep 2013 10:01 PM |
I mean, process goes as is:
for i=1,30 do RTime.Value=30-i wait(1) end
First iteration: i = 1, 30-i = 29, RTime = 29 Second: i = 2, 30-i = 28, RTime = 28..ect. Eventually ending at 30-30 which is 0 Can numvalues be 0? I think they can |
|
|
| Report Abuse |
|
|
|
| 17 Sep 2013 10:01 PM |
It still freezes, Geo.
Did For/While/Repeat loops break?
I just tried each and still nothing happens. |
|
|
| Report Abuse |
|
|
Geomaster
|
  |
| Joined: 05 Jul 2008 |
| Total Posts: 1480 |
|
|
| 17 Sep 2013 10:04 PM |
So I just did this on my own
local num = workspace.Num
for i = 30, 1, -1 do num.Value = i wait(1) print(num.Value) end
No freezes, output was a countdown from 30
I have to assume from this that yours is breaking from exterior code |
|
|
| Report Abuse |
|
|
|
| 17 Sep 2013 10:06 PM |
Alright, good to know.
I'll see if I can't find something else that may be the cause of the freezes. |
|
|
| Report Abuse |
|
|
wazap
|
  |
| Joined: 29 Jun 2007 |
| Total Posts: 23234 |
|
|
| 17 Sep 2013 10:07 PM |
Usually when a server freezes, there is an uncontrolled while loop. As in
while true do end
Or something like that. The problem isnt the while true do, or while 2+2 == 4, or while game.Workspace:findFirstChild("Potatos") do, or any of that
The problem is that there is no wait() and that there is an infinite loop. Are you sure that's the script thats causing all the scripts? Or is that script going to trigger another script...? |
|
|
| Report Abuse |
|
|
|
| 17 Sep 2013 10:40 PM |
Well, I fixed the problem somehow.
I think it is my PC. Lately its been acting slower than normal and video/picture quality is bad. But miraculously the freezes stopped. |
|
|
| Report Abuse |
|
|