cbhusker
|
  |
| Joined: 07 Feb 2011 |
| Total Posts: 517 |
|
|
| 02 Jun 2015 05:38 PM |
I need help doing something very simple.
I know how to set a block's position. [part.Position = Vector3.new(#,#,#)]
But how do you change a blocks position. Say the Y Vector was 20. I wanted to change it by subtracting ten. In this situation I will have many of these blocks positioned (100+), and I don't want to set each of the block's X and Z vectors, Just to change the Y vector.
Thank you in advance. Sorry if I sound stupid, I'm not that good at scripting
|
|
|
| Report Abuse |
|
|
chimmihc
|
  |
| Joined: 01 Sep 2014 |
| Total Posts: 17143 |
|
|
| 02 Jun 2015 05:40 PM |
part.CFrame = part.CFrame * CFrame.new(0,-10,0)
I script -~ chimmihc |
|
|
| Report Abuse |
|
|
Goulstem
|
  |
| Joined: 04 Jul 2012 |
| Total Posts: 7177 |
|
|
| 02 Jun 2015 05:40 PM |
part.Position = part.Position - Vector3.new(0,10,0)
I personally like to use CFrames..
part.CFrame = part.CFrame * CFrame.new(0,-10,0) |
|
|
| Report Abuse |
|
|
|
| 02 Jun 2015 05:40 PM |
You would mostly use something like this
Block = game.Workspace.Block
Block.Position = Vector3.new(Block.Position.X + 20, Block.Position.Y, Block.Position.Z) |
|
|
| Report Abuse |
|
|
|
| 02 Jun 2015 05:41 PM |
local model = workspace.Model
for _,v in pairs(model:children()) do if v:IsA("BasePart") then v.CFrame = v.CFrame*CFrame.new(0,10,0) end end
Inefficient methods, but works. I recommend SetPrimaryPartCframe |
|
|
| Report Abuse |
|
|
Goulstem
|
  |
| Joined: 04 Jul 2012 |
| Total Posts: 7177 |
|
|
| 02 Jun 2015 05:41 PM |
| ^He was asking for -10 studs on the y axis.. |
|
|
| Report Abuse |
|
|
|
| 02 Jun 2015 05:41 PM |
| The above methods are more effective than mine. |
|
|
| Report Abuse |
|
|
|
| 02 Jun 2015 05:42 PM |
| Sorry, seems i messed up reading it. |
|
|
| Report Abuse |
|
|
cbhusker
|
  |
| Joined: 07 Feb 2011 |
| Total Posts: 517 |
|
|
| 02 Jun 2015 05:52 PM |
I messed up in my initial message in the wording. Here is what I meant:
I want to be able to SET the Y of the block, not change it.. Sorry. |
|
|
| Report Abuse |
|
|
cbhusker
|
  |
| Joined: 07 Feb 2011 |
| Total Posts: 517 |
|
| |
|
|
| 02 Jun 2015 06:09 PM |
local part = workspace.Part
part.CFrame = CFrame.new(part.Position.X,Y-HERE,part.Position.Z) |
|
|
| Report Abuse |
|
|
Goulstem
|
  |
| Joined: 04 Jul 2012 |
| Total Posts: 7177 |
|
|
| 02 Jun 2015 06:12 PM |
| Setting and changing are the same thing, in your case. |
|
|
| Report Abuse |
|
|
TimeTicks
|
  |
| Joined: 27 Apr 2011 |
| Total Posts: 27115 |
|
|
| 02 Jun 2015 06:15 PM |
| goul did u give up on that project |
|
|
| Report Abuse |
|
|
Goulstem
|
  |
| Joined: 04 Jul 2012 |
| Total Posts: 7177 |
|
|
| 02 Jun 2015 06:17 PM |
| I keep seeing you say that. On multiple forums and on my group wall.. PM me whatever project you're talking about please. |
|
|
| Report Abuse |
|
|