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: How can you make a script count instances?

Previous Thread :: Next Thread 
Revelted is not online. Revelted
Joined: 02 Nov 2014
Total Posts: 503
09 Sep 2017 04:56 PM
Because

print(#game.Players:Getchildren()) doesnt work

i dont know any other way lol can someone help me out?

Idk if I should use For i,v in pairs or what.
Report Abuse
22618709 is not online. 22618709
Joined: 25 Dec 2011
Total Posts: 19221
09 Sep 2017 04:59 PM
GetChildren() not Getchildren()


Report Abuse
BunnyBoy26 is not online. BunnyBoy26
Joined: 17 Jun 2010
Total Posts: 5674
09 Sep 2017 05:03 PM
^ Wow what a hero.

local num = 0
function recurse(p)
for _,v in next,p:GetChildren() do
num = num + 1
recurse(v)
end
end
recurse(workspace)
print(num)
Report Abuse
LaeMVP is online. LaeMVP
Joined: 24 Jun 2013
Total Posts: 4416
09 Sep 2017 05:04 PM
*blows everyone's mind with...* GetDescendants
Report Abuse
hunxrepair is online. hunxrepair
Joined: 07 Aug 2011
Total Posts: 777
09 Sep 2017 05:08 PM
local Count = 0
function Search(Obj)
for i,v in pairs(Obj:GetChildren()) do
Count = Count + 1
Search(v)
end
end

Search(game.Workspace)
print("Instances inside game.Workspace: "..Count)
Report Abuse
22618709 is not online. 22618709
Joined: 25 Dec 2011
Total Posts: 19221
09 Sep 2017 05:10 PM
he wrote "print(#game.Players:Getchildren())" so i assume he wants to just get the ammount of children in Players, nothing else


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