Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

toObjectSpace is not a valid member of Part

function Rotate(objects,center,new) 
	for i,object in pairs(objects) do 
		if object.ClassName == "Part" then 
			object.CFrame = new:toWorldSpace(center:toObjectSpace(object.CFrame)) 
		end 
	end 
end

When I call the function: Rotate(slayer:GetChildren(),v,"0,0,100")

Output: toObjectSpace is not a valid member of Part

  • Thank you to anybody who can help me*

1 answer

Rotate(slayer:GetChildren(), v ,"0,0,100")

Is 'v' called "Part"?

17 comments

0

No, its called "Hover"

0

Is that a part though?

0

Yes

0

Try putting center.CFrame:toObjectSpace(object.CFrame) instead.

0

Now its saying: Players.Player1.PlayerGui.Control:13: attempt to call method 'toWorldSpace' (a nil value)

0

Try Rotate(slayer:GetChildren(),v,CFrame.new(0,0,100))

1

:toObjectSpace expects a CFrame value, not a string. http://wiki.roblox.com/index.php?title=CFrame#Methods

1

Rotate(slayer:GetChildren(),v.CFrame,CFrame.new(0,0,100))

0

@Pig @Owen even went I turn it into a CFrame value, the output is: toObjectSpace is not a valid member of Part

0

@1waddle1, I think your way works because it kills me and does not error, so thats good. Thanks guys! Lets just hope I can stop it from killing me(it's in a vehicle)

0

Post the entire code please?

0

@Lineout :toWorldSpace also expects a CFrame, sorry I didn't clarify that. 1waffle's comment should work fine.

0

@Pig: http://pastebin.com/wa30aBzQ Thats not ALL of the code because its 270 lines long but thats what I thank you want to see.

0

Ok so when I move left, everything works but the vehicle and my character get destroyed.... Anybody know why?

0

I don't even know what you are trying to do...

0

I'm trying to move a vehicle to the left, tis a hover craft -_-. When I move to the left, it like breaks all joints and then i dissapear.

0

toObjectSpace should be ToObjectSpace (capital letter) - I had the same issue because I had misspelt it.

This discussion is preserved as it was. New answers, comments, and votes are closed.