ked2000
|
  |
| Joined: 10 Jul 2011 |
| Total Posts: 1059 |
|
|
| 27 Jul 2014 11:44 AM |
I have a function definition called run() at line 174. It continues running in a endless loop. I do not know what this error means, I have never had it before. I do not want to post a whole block of code if it won't help. I looked this error up but I did not find anything.
Can someone tell me what's causing this(I will post the code if need be)?
Error: Workspace.Main: 174: Game script timeout |
|
|
| Report Abuse |
|
|
|
| 27 Jul 2014 11:46 AM |
| its becuz ur code is horrible |
|
|
| Report Abuse |
|
|
ked2000
|
  |
| Joined: 10 Jul 2011 |
| Total Posts: 1059 |
|
| |
|
|
| 27 Jul 2014 11:55 AM |
| post ur code and i can help |
|
|
| Report Abuse |
|
|
ked2000
|
  |
| Joined: 10 Jul 2011 |
| Total Posts: 1059 |
|
| |
|
| |
|
ked2000
|
  |
| Joined: 10 Jul 2011 |
| Total Posts: 1059 |
|
|
| 27 Jul 2014 11:57 AM |
function run() while true do local currentSet = {}; if (sets[chosenSet]) then for _, player in pairs(game:GetService("Players"):GetPlayers()) do print("Starting next game") local gui = player:FindFirstChild("PlayerGui").TextGui gui.Frame1.TextBox.Text = "Welcome to True or false!" wait(4) for i = 5, 0, -1 do gui.Frame1.TextBox.Text = "Beginning in "..i.." seconds." end chooseSet() gui.Frame1.TextBox.Text = chosenSet.." set selected!"
local index; index, currentSet = chooseQuestions(currentSet) print("Got "..#currentSet.." questions in current set "..chosenSet) teleportPlayer(player, -9.3, 54.99, -461.5) for i, v in pairs(out) do if (v:lower() == player.Name:lower()) then table.remove(out, i)end end table.insert(playing, player.Name) wait(3) gui.Frame1.TextBox.Text = "There are "..#currentSet.." questions in the "..chosenSet.." set!" wait(3) gui.Frame1.TextBox.Text = sets[chosenSet].Reward.." Bronze Coins will be awarded to the winners per round." wait(3) for i = 1, index do gui.Frame1.TextBox.Text = "Question "..i.."!" wait(3) ask(currentSet[i]) end print("Finishing game.") gui.Frame1.TextBox.Text = "Game Over!" wait(3) gui.Frame1.TextBox.Text = "The winner(s) are : "..table.concat(playing, ", ").."! Congratulations!" wait(3) gui.Frame1.TextBox.Text = "The winner(s) are being awarded "..sets[chosenSet].Reward.." Bronze Coins." award(playing) intermission() end end end end
|
|
|
| Report Abuse |
|
|
|
| 27 Jul 2014 12:00 PM |
You should take the loop out and do this instead
while wait() do run() end |
|
|
| Report Abuse |
|
|
|
| 27 Jul 2014 12:02 PM |
* Make sure to remove award and intermission from run()
while wait() do run() award(playing) intermission() end |
|
|
| Report Abuse |
|
|
ked2000
|
  |
| Joined: 10 Jul 2011 |
| Total Posts: 1059 |
|
| |
|
|
| 27 Jul 2014 12:10 PM |
Is this ever true? if (sets[chosenSet]) then |
|
|
| Report Abuse |
|
|
|
| 27 Jul 2014 12:11 PM |
| Trying to figure out why the script isn't waiting |
|
|
| Report Abuse |
|
|
| |
|
|
| 27 Jul 2014 12:15 PM |
| You have an infinite loop somewhere |
|
|
| Report Abuse |
|
|
ked2000
|
  |
| Joined: 10 Jul 2011 |
| Total Posts: 1059 |
|
|
| 27 Jul 2014 12:19 PM |
sets[chosenSet] returns true because it exists.
The only loop that runs forever is in run() |
|
|
| Report Abuse |
|
|
|
| 27 Jul 2014 12:20 PM |
When do you get the error? Does the game at least start? |
|
|
| Report Abuse |
|
|
ked2000
|
  |
| Joined: 10 Jul 2011 |
| Total Posts: 1059 |
|
|
| 27 Jul 2014 12:21 PM |
| I get the error once the server loads(AKA. When I join the game). The game doesn't start because it errors where I call it. |
|
|
| Report Abuse |
|
|
|
| 27 Jul 2014 12:24 PM |
That happens because there aren't any players when the server starts and all the waits are located in the player loop
That means my script works but you didn't use it :( |
|
|
| Report Abuse |
|
|
|
| 27 Jul 2014 12:25 PM |
Or before calling run repeat wait(.1) until #game.Players:GetPlayers() > 0 |
|
|
| Report Abuse |
|
|
ked2000
|
  |
| Joined: 10 Jul 2011 |
| Total Posts: 1059 |
|
|
| 27 Jul 2014 12:29 PM |
| I tried your methods and I added a function to wait for players, I still get the error. |
|
|
| Report Abuse |
|
|
|
| 27 Jul 2014 12:32 PM |
function run() local currentSet = {}; if (sets[chosenSet]) then for _, player in pairs(game:GetService("Players"):GetPlayers()) do print("Starting next game") local gui = player:FindFirstChild("PlayerGui").TextGui gui.Frame1.TextBox.Text = "Welcome to True or false!" wait(4)
for i = 5, 0, -1 do gui.Frame1.TextBox.Text = "Beginning in "..i.." seconds." end
chooseSet() gui.Frame1.TextBox.Text = chosenSet.." set selected!"
local index; index, currentSet = chooseQuestions(currentSet)
print("Got "..#currentSet.." questions in current set "..chosenSet) teleportPlayer(player, -9.3, 54.99, -461.5) for i, v in pairs(out) do if (v:lower() == player.Name:lower()) then table.remove(out, i)end end table.insert(playing, player.Name)
wait(3)
gui.Frame1.TextBox.Text = "There are "..#currentSet.." questions in the "..chosenSet.." set!" wait(3)
gui.Frame1.TextBox.Text = sets[chosenSet].Reward.." Bronze Coins will be awarded to the winners per round." wait(3)
for i = 1, index do gui.Frame1.TextBox.Text = "Question "..i.."!" wait(3) ask(currentSet[i]) end
print("Finishing game.") gui.Frame1.TextBox.Text = "Game Over!" wait(3) gui.Frame1.TextBox.Text = "The winner(s) are : "..table.concat(playing, ", ").."! Congratulations!" wait(3) gui.Frame1.TextBox.Text = "The winner(s) are being awarded "..sets[chosenSet].Reward.." Bronze Coins."
award(playing) intermission() end end end
while wait() do repeat wait(.1) until #game.Players:GetPlayers() > 0 run() end |
|
|
| Report Abuse |
|
|
ked2000
|
  |
| Joined: 10 Jul 2011 |
| Total Posts: 1059 |
|
| |
|