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
|
  |
| Joined: 24 Jun 2011 |
| Total Posts: 1451 |
|
| |
|
andr315j
|
  |
| Joined: 25 Mar 2012 |
| Total Posts: 518 |
|
| |
|
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
|
  |
| 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
|
  |
| 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
|
  |
| Joined: 10 Dec 2011 |
| Total Posts: 20341 |
|
| |
|
|
| 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
|
  |
| 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
|
  |
| Joined: 24 Jun 2011 |
| Total Posts: 1451 |
|
|
| 24 Mar 2016 10:45 AM |
Never mind, I figured it out. Thanks. |
|
|
| Report Abuse |
|
|
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
|
  |
| 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 |
|
|
|
| 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 |
|
|