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: Problem With CFrame

Previous Thread :: Next Thread 
wentman is not online. wentman
Joined: 13 Aug 2013
Total Posts: 130
05 Aug 2017 01:58 PM
I tried this:
for _,v in pairs (workspace.Car:GetChildren()) do
v.CFrame = v.CFrame + Vector3.new(0,0,5)
print(v.Position)

and then the output says:
11:58:30.589 - CFrame is not a valid member of Script
11:58:30.590 - Stack Begin
11:58:30.590 - Script 'Workspace.Car.Script', Line 18
11:58:30.591 - Stack End
Report Abuse
wentman is not online. wentman
Joined: 13 Aug 2013
Total Posts: 130
05 Aug 2017 02:02 PM
Bumpzzzzz
Report Abuse
wentman is not online. wentman
Joined: 13 Aug 2013
Total Posts: 130
05 Aug 2017 02:03 PM
bump to get on the top
Report Abuse
HeIix is not online. HeIix
Joined: 19 Jan 2013
Total Posts: 253
05 Aug 2017 02:04 PM
for _,v in pairs (workspace.Car:GetChildren()) do
if v.Name ~= "Script" then
v.CFrame = v.CFrame + Vector3.new(0,0,5)
end
print(v.Position)


it's trying to access the CFrame of the script inside the car


‍ ‍ ‍                                            ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍ ‍
Report Abuse
juniorjfive is not online. juniorjfive
Joined: 05 Jan 2010
Total Posts: 671
05 Aug 2017 02:05 PM
"for _,v in pairs (workspace.Car:GetChildren()) do
v.CFrame = v.CFrame + Vector3.new(0,0,5)
print(v.Position)
"

after the iteration, check to see if "v" is a BasePart so that it doesn't confuse the loop.

Should look like this:

for _,v in pairs (workspace.Car:GetChildren()) do
if v:IsA"BasePart" then
v.CFrame = v.CFrame + Vector3.new(0,0,5)
print(v.Position)
end
Report Abuse
wentman is not online. wentman
Joined: 13 Aug 2013
Total Posts: 130
05 Aug 2017 02:05 PM
Thx. I'll try that
Report Abuse
juniorjfive is not online. juniorjfive
Joined: 05 Jan 2010
Total Posts: 671
05 Aug 2017 02:06 PM
@Helix, that only checks for Names. There could be a part named "Script" for all we know
Report Abuse
wentman is not online. wentman
Joined: 13 Aug 2013
Total Posts: 130
05 Aug 2017 02:06 PM
Thanks! I didn't notice I put my script inside the car XD.
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