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 » Scripters
Home Search
 

Re: Why is my arguement nil?

Previous Thread :: Next Thread 
adeep is not online. adeep
Joined: 06 Feb 2010
Total Posts: 274
10 Dec 2014 11:21 PM
Code-

-- Chance to be judge is a select few players from game.Players

function BuildEnd()
local hint = Instance.new("Hint", game.Workspace)
hint.Text = "Prepare to present your builds!"
for i = 1, #ChanceToBeJudge do
local x = ChanceToBeJudge[i].Backpack:GetChildren()
for c = 1, #x do
x[1]:Destroy()
end
end
wait(3)
hint:Destroy()
print("NOT DONE")
return
end
Report Abuse
adeep is not online. adeep
Joined: 06 Feb 2010
Total Posts: 274
10 Dec 2014 11:23 PM
local x = ChanceToBeJudge[i].Backpack:GetChildren() <--- This is nil
Report Abuse
izzatnasruna is not online. izzatnasruna
Joined: 09 Jun 2009
Total Posts: 1927
10 Dec 2014 11:27 PM
What is this 'ChanceToBeJudge'?

Does it mean, a set of table with some randomly selected players?
Report Abuse
adeep is not online. adeep
Joined: 06 Feb 2010
Total Posts: 274
10 Dec 2014 11:28 PM
ChanceToBeJudge = game.Players:GetChildren()
Report Abuse
izzatnasruna is not online. izzatnasruna
Joined: 09 Jun 2009
Total Posts: 1927
10 Dec 2014 11:38 PM
How about you replace

for i = 1, #ChanceToBeJudge do
local x = ChanceToBeJudge[i].Backpack:GetChildren()
for c = 1, #x do
x[1]:Destroy()
end
end

with

for i,Player in pairs(ChanceToBeJudge) do
for c,x in pairs(Player:GetChildren()) do
x:Destroy()
end
end
Report Abuse
haloisabeast is not online. haloisabeast
Joined: 28 Jun 2009
Total Posts: 366
10 Dec 2014 11:59 PM
I'm pretty sure you can't :GetChildren() after a :GetChildren(), which would be pretty sweet. You have to use pairs like @above.
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
11 Dec 2014 12:05 AM
Sure you can, with MTs or index first :)

print(game:GetChildren()[1]:GetChildren()[1].Name);

Report Abuse
haloisabeast is not online. haloisabeast
Joined: 28 Jun 2009
Total Posts: 366
11 Dec 2014 02:35 PM
Well, the way you did it, you referenced a specific child with the [1]. You can't reference all of the children of already referenced children using two :GetChilren()'s though, unfortunately. You can select the children of one object at a time though, just not all the objects, which is where a for loop comes in handy.
Report Abuse
cntkillme is not online. cntkillme
Joined: 07 Apr 2008
Total Posts: 44956
11 Dec 2014 02:39 PM
'Sure you can, with MTs' :)
Although you would still use a loop in the MM
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • 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