|
| 15 Sep 2011 07:24 PM |
Someone once told me you can move two bricks at once if they're welded by using something like:
game.Workspace.blox1.CFrame = game.Workspace.blox1.CFrame + Vector3.new(0,0,2)
If they are both anchored, it moves just one brick. If just one is anchored, it moves just one brick. If both are unanchored, it does nothing.
I could move all the children of the model using a loop, but want to see if there is a shorter way. |
|
|
| Report Abuse |
|
|
| |
|
|
| 15 Sep 2011 08:22 PM |
a = script.Parent.Parent.Brick1 b = script.Parent.Parent.Brick2
Brick1.CFrame = CFrame.new(Brick1.Position - Vector3.new(0,0,-1)) Brick2.CFrame = CFrame.new(Brick2.Position - Vector3.new(0,0,-1))
In this case both bricks are anchored and both bricks will move. |
|
|
| Report Abuse |
|
|
|
| 15 Sep 2011 08:23 PM |
a = script.Parent.Parent.Brick1 b = script.Parent.Parent.Brick2
a.CFrame = CFrame.new(a.Position - Vector3.new(0,0,-1)) b.CFrame = CFrame.new(b.Position - Vector3.new(0,0,-1))
In this case both bricks are anchored and both bricks will move.
Remember that's part of a script. |
|
|
| Report Abuse |
|
|
grimm343
|
  |
| Joined: 18 Sep 2008 |
| Total Posts: 2796 |
|
|
| 15 Sep 2011 09:39 PM |
You could do that, or make a loop. Example.. Name each brick you want moved as 'something' Their Parent is Workspace.
local z = game.Workspace:GetChildren()
for i=1, #z do if z[i].Name == "something" then z[i].CFrame = z[i].CFrame + Vector3.new(0,0,1) end end
Another way.. Put all the bricks you want CFramed into a model. Name the model "lolzfosdf".
local bricks = game.Workspace.lolzfosdf:GetChildren()
for i=1, #bricks do bricks[i].CFrame = bricks[i].CFrame + Vector3.new(0,0,1) end
To CFrame all of the bricks in a model, and all of the bricks that may be in a model inside of that first model, you would do this.
Name the first 'zcframe'.
local m = game.Workspace.zcframe:GetChildren()
for i=1, #m do if m[i].className == "Part" then m[i].CFrame = m[i].CFrame + Vector3.new(0,50,0) end local z = m[i]:GetChildren() for i=1, #z do if z[i].className == "Part" then z[i].CFrame = z[i].CFrame + Vector3.new(0,50,0) end end end |
|
|
| Report Abuse |
|
|