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: Basic Scripting [part positioning]

Previous Thread :: Next Thread 
cbhusker is not online. 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 is not online. 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 is not online. 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
bluefrog53 is not online. bluefrog53
Joined: 05 Feb 2012
Total Posts: 766
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
iSpecializinq is not online. iSpecializinq
Joined: 31 May 2015
Total Posts: 2182
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 is not online. 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
bluefrog53 is not online. bluefrog53
Joined: 05 Feb 2012
Total Posts: 766
02 Jun 2015 05:41 PM
The above methods are more effective than mine.
Report Abuse
iSpecializinq is not online. iSpecializinq
Joined: 31 May 2015
Total Posts: 2182
02 Jun 2015 05:42 PM
Sorry, seems i messed up reading it.
Report Abuse
cbhusker is not online. 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 is not online. cbhusker
Joined: 07 Feb 2011
Total Posts: 517
02 Jun 2015 06:04 PM
b1
Report Abuse
iSpecializinq is not online. iSpecializinq
Joined: 31 May 2015
Total Posts: 2182
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 is not online. 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 is not online. 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 is not online. 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
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