leo1998XD
|
  |
| Joined: 16 Oct 2011 |
| Total Posts: 893 |
|
|
| 29 Aug 2013 05:05 PM |
minigames = {}
for i,v in pairs(game.Lighting:GetChildren()) do if v:IsA("Model") then table.insert(minigames,v) end end
function playerWon(player) local m = Instance.new("Message",game.Workspace) --something about this dosent work m.Text = player.Name.." has won the minigame!" wait(3) m:Destroy() end
function chooseMinigame() return minigames[math.random(1,#minigames)] end
function getParticipants() game.Players:GetPlayers() end
function teleportPlayers(Players) --TODO:Move all players to map end
function loadMinigame(mg) local m = mg:clone() m.Parent = workspace return m end
local m = chooseMinigame() local loaded = loadMinigame(m)
function runMinigame(mg) --TODO:tele all participants to the correct locations while m.time.Value > 0 do -- TODO:Check to see if game is running if m.winner.Value then playerWon(m.winner.Value) break end wait() end end
function endMinigame(m) m:Destroy() end
while wait() do runMinigame(loaded) endMinigame(loaded) end
i tried output but it said i had no errors
|
|
|
| Report Abuse |
|
|
Soquick
|
  |
| Joined: 01 Nov 2012 |
| Total Posts: 1497 |
|
|
| 29 Aug 2013 05:06 PM |
| loaded not defined on last lines |
|
|
| Report Abuse |
|
|
leo1998XD
|
  |
| Joined: 16 Oct 2011 |
| Total Posts: 893 |
|
| |
|
Raphael7
|
  |
| Joined: 03 Dec 2008 |
| Total Posts: 2479 |
|
| |
|
leo1998XD
|
  |
| Joined: 16 Oct 2011 |
| Total Posts: 893 |
|
|
| 29 Aug 2013 05:15 PM |
function chooseMinigame() return minigames[math.random(1,#minigames)] end
function getParticipants() game.Players:GetPlayers() end
function teleportPlayers(Players) --TODO:Move all players to map end
function loadMinigame(mg) local m = mg:clone() m.Parent = workspace return m end
function runMinigame(mg) --TODO:tele all participants to the correct locations while m.time.Value > 0 do -- TODO:Check to see if game is running if m.winner.Value then playerWon(m.winner.Value) break end wait() end end
function endMinigame(m) m:Destroy() end
while wait() do local m = chooseMinigame() local loaded = loadMinigame(m) runMinigame(loaded) endMinigame(loaded) end
15:14:26.758 - Workspace.Main:17: bad argument #2 to 'random' (interval is empty) 15:14:26.759 - Script 'Workspace.Main', Line 17 - global chooseMinigame 15:14:26.759 - Script 'Workspace.Main', Line 54 |
|
|
| Report Abuse |
|
|
leo1998XD
|
  |
| Joined: 16 Oct 2011 |
| Total Posts: 893 |
|
| |
|
leo1998XD
|
  |
| Joined: 16 Oct 2011 |
| Total Posts: 893 |
|
| |
|
|
| 29 Aug 2013 05:20 PM |
minigames = {} return minigames[math.random(1,#minigames)]
You're basically saying math.random(1,0). You can't do that. |
|
|
| Report Abuse |
|
|
Soquick
|
  |
| Joined: 01 Nov 2012 |
| Total Posts: 1497 |
|
|
| 29 Aug 2013 05:20 PM |
function chooseMinigame() return minigames:children()[math.random(1,#minigames:children())] end |
|
|
| Report Abuse |
|
|
Raphael7
|
  |
| Joined: 03 Dec 2008 |
| Total Posts: 2479 |
|
|
| 29 Aug 2013 05:20 PM |
| On your second script I didn't notice any tables, but I did notice tables on your first script. |
|
|
| Report Abuse |
|
|
Soquick
|
  |
| Joined: 01 Nov 2012 |
| Total Posts: 1497 |
|
|
| 29 Aug 2013 05:21 PM |
forget my post, due to forgetting that it was a table You need 2+ minigames in table |
|
|
| Report Abuse |
|
|
|
| 29 Aug 2013 05:21 PM |
| You only need one but it wouldn't really be random o3o. |
|
|
| Report Abuse |
|
|
leo1998XD
|
  |
| Joined: 16 Oct 2011 |
| Total Posts: 893 |
|
|
| 29 Aug 2013 05:27 PM |
| I posted from the so called 'error' on so from line 17 on |
|
|
| Report Abuse |
|
|