BogyMac
|
  |
| Joined: 04 Nov 2011 |
| Total Posts: 823 |
|
|
| 11 Oct 2013 10:08 PM |
So, I've tried this numerous times in the past, and it never works, no matter what I try. It's a script that will take all bricks in a model and bob them up and down. This method doesn't seem to work:
while true do for i = 1, 100 do --stuff end for i = 1, 100 do --more stuff end end
-------------------------------------------------------------------------------
Any different, better methods of doing this? (maybe for i, v in pairs do?)
Thanks for any help, -Bogy |
|
|
| Report Abuse |
|
|
|
| 11 Oct 2013 10:52 PM |
That method will work.
Can you post the 'stuff' and 'more stuff'? That's where your problem is likely to be. |
|
|
| Report Abuse |
|
|
Excellus
|
  |
| Joined: 17 Jun 2013 |
| Total Posts: 3939 |
|
|
| 11 Oct 2013 10:54 PM |
| If seriously used that as a script, I've lost my faith in humanity. |
|
|
| Report Abuse |
|
|
BogyMac
|
  |
| Joined: 04 Nov 2011 |
| Total Posts: 823 |
|
|
| 12 Oct 2013 11:28 AM |
Whole script: ------------------------------------------------------------------------------------------------------------------------------- blocks = script.Parent:GetChildren() while true do for i = 1, 100 do for i = 1, #blocks do if blocks.ClassName == "Part" then blocks.Mesh.Offset = blocks.Mesh.Offset + Vector3.new(0, 0.01, 0) end end wait() end for i = 1, 100 do for i = 1, #blocks do if blocks.ClassName == "Part" then blocks.Mesh.Offset = blocks.Mesh.Offset - Vector3.new(0, 0.01, 0) end end wait() end wait() end ------------------------------------------------------------------------------------------------------------------------------- Note: This script DOES have correct indentation, it just won't show up here.
I can't seem to find any reason why this script won't work. -Bogy |
|
|
| Report Abuse |
|
|
BogyMac
|
  |
| Joined: 04 Nov 2011 |
| Total Posts: 823 |
|
| |
|
BogyMac
|
  |
| Joined: 04 Nov 2011 |
| Total Posts: 823 |
|
|
| 12 Oct 2013 01:00 PM |
Really? No one here knows how to help me?
Come on, guys! I'm not asking you to make a whole giant script for me, just please tell me what I have to do to fix this, there is no reason that I can see as to why this won't work. |
|
|
| Report Abuse |
|
|
|
| 12 Oct 2013 01:03 PM |
blocks = script.Parent:GetChildren() while true do for i = 1, 100 do for i,v in ipairs(blocks) do if v.ClassName == "Part" then v.Mesh.Offset = v.Mesh.Offset + Vector3.new(0, 0.01, 0) end end wait() end
for i = 1, 100 do for i,v in ipairs(blocks) do if v.ClassName == "Part" then v.Mesh.Offset = v.Mesh.Offset - Vector3.new(0, 0.01, 0) end end wait() end wait() end |
|
|
| Report Abuse |
|
|
|
| 12 Oct 2013 01:04 PM |
as for the reasoning: blocks is a table and you were trying to edit the properties of the table itself edit the properties of everything inside a table by using for i,v in ipairs(table) do |
|
|
| Report Abuse |
|
|
BogyMac
|
  |
| Joined: 04 Nov 2011 |
| Total Posts: 823 |
|
|
| 12 Oct 2013 01:13 PM |
| I see, testing it out now... |
|
|
| Report Abuse |
|
|
BogyMac
|
  |
| Joined: 04 Nov 2011 |
| Total Posts: 823 |
|
| |
|