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
 

Previous Thread :: Next Thread 
Leg0brick is not online. Leg0brick
Joined: 24 Jul 2012
Total Posts: 651
20 Aug 2015 11:36 PM
I'm working on a script that takes all the parts in a model and moves them 1 stud one way, but I'm getting a strange error on line three. "bad argument #2 to '?' (Vector3 expected, got CFrame)" Here is the code:

for name, child in pairs(workspace.Truck1:GetChildren()) do
if child:IsA("BasePart") then
child.CFrame = child.CFrame + CFrame.new(0,0,10)
end
end
Report Abuse
Qaynar is not online. Qaynar
Joined: 01 Feb 2015
Total Posts: 486
20 Aug 2015 11:39 PM
CFrame you have to do
child.CFrame = CFrame.new(child.CFrame.X, child.CFrame.Y, child.CFrame.Z + 10)
Report Abuse
Seranok is not online. Seranok
Joined: 12 Dec 2009
Total Posts: 11083
20 Aug 2015 11:40 PM
You can't add two CFrames, so add a Vector3 to that CFrame instead:

child.CFrame = child.CFrame + Vector3.new(0,0,1)
Report Abuse
Leg0brick is not online. Leg0brick
Joined: 24 Jul 2012
Total Posts: 651
20 Aug 2015 11:41 PM
Thank you both very much! It works now!
Report Abuse
Vortilis is not online. Vortilis
Joined: 06 Jul 2014
Total Posts: 14163
20 Aug 2015 11:42 PM
i thought it was obvious enough from the error?
for i, v in pairs(game.Workspace.Truck1:GetChildren()) do
if v:IsA("Part") then
v.Position = v.Position + Vector3.new(0,0,10)
print("Vortilis is awesome")
end
end
Report Abuse
SenseiWarrior is not online. SenseiWarrior
Joined: 09 Apr 2011
Total Posts: 12140
20 Aug 2015 11:52 PM
With CFrame it is CFrame * CFrame (it doesnt multiply, it adds)
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