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: Cant find any errors. (Help)

Previous Thread :: Next Thread 
leo1998XD is not online. 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 is not online. Soquick
Joined: 01 Nov 2012
Total Posts: 1497
29 Aug 2013 05:06 PM
loaded not defined on last lines
Report Abuse
leo1998XD is not online. leo1998XD
Joined: 16 Oct 2011
Total Posts: 893
29 Aug 2013 05:08 PM
Thanks ill try fixing it.
Report Abuse
Raphael7 is not online. Raphael7
Joined: 03 Dec 2008
Total Posts: 2479
29 Aug 2013 05:09 PM
Dem fawnctions r a lot.
Report Abuse
leo1998XD is not online. 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 is not online. leo1998XD
Joined: 16 Oct 2011
Total Posts: 893
29 Aug 2013 05:16 PM
getting that problem now
Report Abuse
leo1998XD is not online. leo1998XD
Joined: 16 Oct 2011
Total Posts: 893
29 Aug 2013 05:18 PM
(posted from liine 17 on)
Report Abuse
ScrewDeath is not online. ScrewDeath
Joined: 03 Jun 2012
Total Posts: 2700
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 is not online. 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 is not online. 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 is not online. 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
ScrewDeath is not online. ScrewDeath
Joined: 03 Jun 2012
Total Posts: 2700
29 Aug 2013 05:21 PM
You only need one but it wouldn't really be random o3o.
Report Abuse
leo1998XD is not online. 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
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