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: _Changed Event Question

Previous Thread :: Next Thread 
PuzzleCrazy is not online. PuzzleCrazy
Joined: 01 Feb 2010
Total Posts: 1245
29 Jul 2011 06:14 PM
How would you check the number of objects inside of another objects being changed, for example, how would I check if the number of players is increased or decreased. (Without check 'NumPlayers' and without using the _OnEntered and _OnLeave functions)
Report Abuse
5943539 is not online. 5943539
Joined: 05 Jan 2010
Total Posts: 810
29 Jul 2011 06:17 PM
PlayerAdded and PlayerRemoving. They're events in the players service.
Report Abuse
PuzzleCrazy is not online. PuzzleCrazy
Joined: 01 Feb 2010
Total Posts: 1245
29 Jul 2011 06:30 PM
I said without using those functions, I'm just using Players as an example, I'll apply the answer to my problem.
Report Abuse
RawrBot is not online. RawrBot
Joined: 22 Aug 2008
Total Posts: 832
29 Jul 2011 06:37 PM
If you want the number of stuff inside a Model:

(a model with 5 bricks)
modelstuff = Model:GetChildren()

print(#modelstuff)

>5
Report Abuse
PuzzleCrazy is not online. PuzzleCrazy
Joined: 01 Feb 2010
Total Posts: 1245
29 Jul 2011 06:38 PM
... No, that's not what I want at all, please read my post carefully.
Report Abuse
RawrBot is not online. RawrBot
Joined: 22 Aug 2008
Total Posts: 832
29 Jul 2011 06:43 PM
object.Changed:connect(

--find the number of objects inside it

)
Report Abuse
Cliff86 is not online. Cliff86
Joined: 01 Mar 2008
Total Posts: 216
29 Jul 2011 06:51 PM
i = game.model:getChildren()
m = Instance.new("Hint", workspace)
print("Hello World!")

num = #i

function getnum()
i = game.model:getChildren()
newnum = #i
dif = math.abs (newnum - num)
if newnum > num then
print(dif .. " objects were added to model")
elseif newnum < num then
print(dif .. " objects were removed from model")
end
num = newnum
end

workspace.model.DescendantAdded:connect(getnum)
workspace.model.DescendantRemoving:connect(delay(1,getnum))
Report Abuse
RawrBot is not online. RawrBot
Joined: 22 Aug 2008
Total Posts: 832
29 Jul 2011 06:53 PM
modelstuff = Model:GetChildren()

Model.Changed:connect(function()
newmodelstuff = Model:GetChildren()

if #newmodelstuff > #modelstuff then
print("Increased")
else
print("Not increased")
end

end)
Report Abuse
RawrBot is not online. RawrBot
Joined: 22 Aug 2008
Total Posts: 832
29 Jul 2011 06:54 PM
Nevermind, late post.
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