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 » Scripting Helpers
Home Search
 

Re: CFrame Movement

Previous Thread :: Next Thread 
thepie56 is not online. thepie56
Joined: 06 Jun 2008
Total Posts: 10
30 Sep 2013 02:56 PM
So I have been learning a bit about scripting and I have recently been fooling around with CFrame movement. As so;

p = game.Workspace.Part


for i = 1,20 do
p.CFrame = CFrame.new(91.5+i, 19.8, -7)
wait()
end

I noticed that in order for it to start from the point I want it to, I have to put in the current position then the variable(91.5+i, 19.8, -7) with the 91.5 being the X axis. Is there a way I get the object to locate itself and move from there on? Feel free to ask for more info if you don't understand what i'm asking.
Report Abuse
sunday1520 is not online. sunday1520
Joined: 23 Aug 2012
Total Posts: 693
30 Sep 2013 02:58 PM
p = game.Workspace.Part


for i = 91.5,111.5 do
p.CFrame = CFrame.new(i, 19.8, -7)
wait()
end


There ya, its just simply changing the numbers in the for loop. However there is a ton of different ways you could do this. Have fun scripting :)
Report Abuse
rosie92680 is not online. rosie92680
Joined: 17 Oct 2011
Total Posts: 1511
30 Sep 2013 03:07 PM
What's the difference between CFrame and Vector3??? Cause I noticed Vector3 moves when you touch it, IDK about CFrame.
Report Abuse
thepie56 is not online. thepie56
Joined: 06 Jun 2008
Total Posts: 10
30 Sep 2013 03:08 PM
Yea, I know that :P I meant that if I moved the brick, it would move from the position I moved it to, and I wouldn't have to put in the new position. It would just locate itself and move from the position it's currently in.
Report Abuse
thepie56 is not online. thepie56
Joined: 06 Jun 2008
Total Posts: 10
30 Sep 2013 03:09 PM
@sunday1520
Report Abuse
sunday1520 is not online. sunday1520
Joined: 23 Aug 2012
Total Posts: 693
30 Sep 2013 03:12 PM
I dont quite understand what your asking then.
Report Abuse
JoshuaKempfert is not online. JoshuaKempfert
Joined: 16 Feb 2013
Total Posts: 2407
30 Sep 2013 03:15 PM
p = game.Workspace.Part


for i = 1,20 do
p.CFrame = CFrame.new(p.CFrame.X+1,p.CFrame.Y,p.CFrame.Z)-- I put plus one because adding i wouldnt make it tween.
wait()
end
Report Abuse
XAXA is not online. XAXA
Joined: 10 Aug 2008
Total Posts: 6315
30 Sep 2013 03:21 PM
p = game.Workspace.Part
pCFrame = game.Workspace.Part.CFrame

for i = 1,20 do
p.CFrame = pCFrame + CFrame.new(1,0,0) -- changing "1" to "i" in this line will make the block accelerate. You may not want that.
wait()
end
Report Abuse
thepie56 is not online. thepie56
Joined: 06 Jun 2008
Total Posts: 10
30 Sep 2013 03:21 PM
Works like a charm, thanks man!
Report Abuse
XAXA is not online. XAXA
Joined: 10 Aug 2008
Total Posts: 6315
30 Sep 2013 03:21 PM
JoshuaKempfert's method will work, too.
Report Abuse
thepie56 is not online. thepie56
Joined: 06 Jun 2008
Total Posts: 10
30 Sep 2013 03:25 PM
Yea, was thanking him and then your post popped up right after :P Both still work though, so thank you both.

:)
Report Abuse
JoshuaKempfert is not online. JoshuaKempfert
Joined: 16 Feb 2013
Total Posts: 2407
30 Sep 2013 03:27 PM
:D
Report Abuse
ProjectsHidden is not online. ProjectsHidden
Joined: 29 Sep 2013
Total Posts: 194
30 Sep 2013 03:32 PM
xaxa, you cant add CFrame values
Report Abuse
XAXA is not online. XAXA
Joined: 10 Aug 2008
Total Posts: 6315
30 Sep 2013 03:38 PM
http://wiki.roblox.com/index.php/CFrame

I do this all the time in the command bar...
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • 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