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: Doing something to every Part in a Model?

Previous Thread :: Next Thread 
Craftero is not online. Craftero
Joined: 24 Jun 2011
Total Posts: 1451
24 Mar 2016 08:07 AM
How do you do something to every Part in a Model at the same time?

Basically, I want all the parts in a model to grow in Size by 1 all at the same time.
I've tried this, but it hasn't worked:

for i=1, 100 do
for i, v in pairs (script.Parent.Circles:GetChildren()) do
v.Size = Vector3.new(v.Size.X + 1, v.Size.X + 1, v.Size.X + 1)
wait(1)
v.Size = Vector3.new(v.Size.X - 1, v.Size.X - 1, v.Size.X - 1)
end
end

Do I really have to use a Module script and call the module from a script inside each individual Part, or is there a more efficient way?

Report Abuse
Craftero is not online. Craftero
Joined: 24 Jun 2011
Total Posts: 1451
24 Mar 2016 09:18 AM
Any ideas?
Report Abuse
andr315j is not online. andr315j
Joined: 25 Mar 2012
Total Posts: 518
24 Mar 2016 09:25 AM
yes
Report Abuse
andr315j is not online. andr315j
Joined: 25 Mar 2012
Total Posts: 518
24 Mar 2016 09:26 AM
it's good if there isn't that many parts :P
Report Abuse
andr315j is not online. andr315j
Joined: 25 Mar 2012
Total Posts: 518
24 Mar 2016 09:32 AM
Basically, heres what to do:

Create a script called
1st (name the script that)

script:

wait (amount of time)
timer = true

end



then copy paste this into all others:
Script name: 2nd



wait (.1)
timer = true
else (loop) [i can't figure out how to make a loop here].
(now you want to make what the parts should do!)
Report Abuse
Craftero is not online. Craftero
Joined: 24 Jun 2011
Total Posts: 1451
24 Mar 2016 09:39 AM
@andr315j
You're not making sense.

If I've interpreted the code(?) above correctly, it would be more efficient just to use a Module Script and call the module from each of the Parts.

Thanks for the suggestion, anyway.

Does anybody else know of any effect techniques of doing what I'm trying to achieve?
Report Abuse
xlaser23 is not online. xlaser23
Joined: 10 Dec 2011
Total Posts: 20341
24 Mar 2016 09:42 AM
used i twice
Report Abuse
AbstractMadness is not online. AbstractMadness
Joined: 22 Dec 2014
Total Posts: 20425
24 Mar 2016 09:46 AM
... idiot

for i = 1,100 do
for i,v in next, script.Parent.Circles:GetChildren() do
spawn(function()
v.Size = v.Size + Vector3.new(1, 1, 1)
wait(1)
v.Size = v.Size - Vector3.new(1, 1, 1)
end)
end
end



#code R+ | local RAP = "R$375,191"; local robux = "R$260"
Report Abuse
Craftero is not online. Craftero
Joined: 24 Jun 2011
Total Posts: 1451
24 Mar 2016 10:23 AM
@AbstractMadness

Thanks very much for your suggestion.

How could I change it to make all the Parts enlarged, shrink, enlarged, shrink repetitively forever?
I've tried editing a few of the lines but haven't had any luck.

When I say "forever", I'm talking " while true do " kind of forever, by the way.
Report Abuse
Craftero is not online. Craftero
Joined: 24 Jun 2011
Total Posts: 1451
24 Mar 2016 10:45 AM
Never mind, I figured it out.
Thanks.
Report Abuse
Craftero is not online. Craftero
Joined: 24 Jun 2011
Total Posts: 1451
24 Mar 2016 10:50 AM
Although, I have a question.

How do you change one of the Parts within the "in next" loop?

Say I want a certain Part to change Size by a different increment.
How do I do that?



I've been trying to add this, but it seems to apply to all the parts:

if v.Name == ("Centre") then
Increment = 10

end

v.Size = v.Size + Vector3.new(Increment, Increment, Increment)


How can I do this effectively?
Report Abuse
fixylol is not online. fixylol
Joined: 14 Dec 2012
Total Posts: 7412
24 Mar 2016 10:55 AM
while wait() do
for i,v in pairs(ReplaceThisWithYourObject:GetChildren()) do
[insert shrink/enlarge script here]
end
end

that should work

Number of times opinion has changed: A lot.
Report Abuse
pinballboy7 is not online. pinballboy7
Joined: 12 Mar 2009
Total Posts: 1485
24 Mar 2016 12:22 PM
You could add all the children to a table and then access them from the table all at once.
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