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

I'm using cFrame to rotate an object but it doesn't work as expected?

Asked by 3 years ago
Edited 3 years ago

When I try to rotate the object, it doesn't end up like the other objects. Before I used to just put parts named "animation" and in scripts I would make the animation parts invisible and visible whenever they were supposed to be. I decided it would be easier learning how to use CFrame and Vector3 for this instead of just copying parts naming them animation and you get it.. however whenever I use cFrame and Vector3 on of the parts, they don't end up how their supposed to be. I copied it's "animation" part's position and that worked for Vector. But copying the orientation didn't work out, it would almost look the same but that's not what I want. So I tried using math.rad that didn't work and now I ended up here. Is there a reason for why it's not working?

Edit: For better understanding on what I'm trying to do. I'm trying to make a lever you can click to pull down and then click again to pull up.

Edit 2: Here's pictures for what it looks like https://drive.google.com/drive/folders/1ROfmEYe3qlMSPdPkP4vx66062zk_mFHk?usp=sharing

local newCFrame = CFrame.Angles(-1.3, -178.87, 154.05)
local newCFrame2 = CFrame.Angles(0, -178.28, 104.89)
script.Parent.ClickDetector.MouseClick:Connect(function()
    script.parent.Switch:Play()
    if script.parent.Position == Vector3.new(-41839.477, 59064.758, -48578.508) then
        script.parent.CFrame = newCFrame2
        script.parent.Position = Vector3.new(-41839.734, 59065.086, -48578.508)
    else
        script.parent.CFrame = newCFrame
        script.Parent.Position = Vector3.new(-41839.477, 59064.758, -48578.508)
    end
end)

Math.rad version

local newCFrame = CFrame.Angles(-1.3, math.rad(-178.87), 154.05)
local newCFrame2 = CFrame.Angles(0, math.rad(-178.28), 104.89)
script.Parent.ClickDetector.MouseClick:Connect(function()
    script.parent.Switch:Play()
    if script.parent.Position == Vector3.new(-41839.477, 59064.758, -48578.508) then
        script.parent.CFrame = newCFrame2
        script.parent.Position = Vector3.new(-41839.734, 59065.086, -48578.508)
    else
        script.parent.CFrame = newCFrame
        script.Parent.Position = Vector3.new(-41839.477, 59064.758, -48578.508)
    end
end)
0
Could you post a few pictures of what happens when you click the lever? radiant_Light203 1166 — 3y
0
Alright sure but currently I dont have a pc at the moment so please wait. DocGooseYT 110 — 3y
0
Look at my post, I edited it. Click the link I put. DocGooseYT 110 — 3y

Answer this question