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

How do I change the orientation of a block using a button?

Asked by 4 years ago

So I have a model with a primary part. I can change the CFrame perfectly. But I'm trying to figure out how to change Orientation, Here is the script I have.

local float = workspace:WaitForChild("Float1")
local targetcframeup = CFrame.new(67.761, 11.58, -12.985)

script.Parent.ClickDetector.MouseClick:Connect(function()
    for i = 0,800,.01 do
        local cf = float.PrimaryPart.CFrame:Lerp(targetcframeup,i)
        float:SetPrimaryPartCFrame(cf)
        wait(.01)
    end
end)

1 answer

Log in to vote
0
Answered by 4 years ago

It's really easy, all you have to do is change CFrame.new to CFrame.Angles, and include math.rad , a bit like this:

local targetcframeup = CFrame.Angles(math.rad(67.761), math.rad(11.58), math.rad(-12.985))

No problem, if you have any questions friend me on discord: Haunted#5196

Ad

Answer this question