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

Why does this turn the brick?

The position to my brick is -150, -3, 267

I write this

script.Parent.CFrame = CFrame.new(-150, 0, 267)

I only want it to move my brick by the Y axis but it moves it by both the Y and the X

Why is this? It's annoying. I've tried to figure it out. Looked on the wiki and I didn't understand it. I did find CFrame.y but I think I used it wrong. Anyone?

2 comments

0

Are you completely sure this is the correct position?

0

Yeah. I found out my brick is rotated by 90 degrees. I can't use Rotation and vector3 to change it back because it would collide with bricks. Can I use some CFrame to rotate it? CFrame.Angles(0,90,0)

2 answers

✓ Accepted answer

Please use comments as opposed to another answer to post an update to your question.

CFrame.Angles is a possible solution to your problem as the part would be rotated 90 radians.

script.Parent.CFrame = CFrame.new(-150, 0, 267) * CFrame.Angles(0, math.rad(90), 0)

2 comments

0

Thank you!!!

0

No problem.

You are using the script.Parent.CFrame = CFrame.new(-150, 0, 267) statement correctly.

There could be multiple reasons for this behavior.

  1. It could be a BodyMover object inside of the part.
  2. Another script intentionally or unintentionally rotating the object.
  3. It could be a Roblox based glitch or corrupted chunk of code.

You could try recreating the place with only the objects you want (make sure there are no hidden or unwanted Scripts of any kind). The easiest way to do this would be to open a new place and copy the objects you want.

The following block of code should help find any unwanted scripts if any exist (it will print the path to all scripts in the game):

local function printScripts(parent)
	for _, v in ipairs(parent:GetChildren()) do
		if v:IsA"Script" then
			print(v:GetFullName())
		end
		printScripts(v)
	end
end

printScripts(game)

Keep in mind that this will not include CoreScripts and StarterScripts.

If for some reason no objects are effecting this part. Try setting up a test place with only the bare minimum to see if you can recreate this behavior. If it still happens, contact Roblox to report a bug report.

1 comment

0

Sorry about the second answer. I replied to late to see that your question had already been resolved. Either way, I hope that what I provided will help you in some way.

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