Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

Why does this turn the brick?

Asked by 9 years ago

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?

0
Are you completely sure this is the correct position? Muoshuu 580 — 9y
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) legoguy939 418 — 9y

2 answers

Log in to vote
2
Answered by 9 years ago

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)

0
Thank you!!! legoguy939 418 — 9y
0
No problem. RaverKiller 668 — 9y
Ad
Log in to vote
0
Answered by 9 years ago

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.

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. cjcool12345 58 — 9y

Answer this question