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

Script that sets a parts Orientation?

Asked by 6 years ago

I used this script to set a parts Orientation when it's clicked, but it says "Cframe is not a valid member of part". Why won't this script work?

local clickdetector = game.Workspace.trap.ClickDetector
clickdetector.MouseClick:Connect(function()
    trap.Orientation = CFrame.Angles(0,0,-90)
0
Orientation is a Vector3, not a CFrame. unmiss 337 — 6y

1 answer

Log in to vote
2
Answered by 6 years ago

That is because the Orientation property of a Part is not a CFrame. It is a Vector3. Do the same thing you were doing but with Vector3.new() instead of CFrame.Angles()

local clickdetector = game.Workspace.trap.ClickDetector
clickdetector.MouseClick:Connect(function()
    trap.Orientation = Vector3.new(0,0,-90)

Also, I am assuming you have an end to close the Connect?

Ad

Answer this question