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

How can I stop my tween from changing rotation?

Asked by 4 years ago

I've made a door and am trying to make it smoothly open up and down with tweenservice, however I get this result: https://gyazo.com/53fca6551673d5b2d715f61570ee5e4d

local function tweenModel(model, CF)
    local CFrameValue = Instance.new("CFrameValue")
    CFrameValue.Value = model:GetPrimaryPartCFrame()

    CFrameValue:GetPropertyChangedSignal("Value"):connect(function()
        model:SetPrimaryPartCFrame(CFrameValue.Value)
    end)

    local tween = TS:Create(CFrameValue, info, {Value = CF})
    tween:Play()

    tween.Completed:connect(function()
        CFrameValue:Destroy()
    end)
end

frameupclose=CFrame.new(54.36, 15.591, 0.29)
frameupopen=CFrame.new(54.36, 24.791, 0.29)
framelowclose=CFrame.new(54.36, 5.541, 0.29)
framelowopen=CFrame.new(54.36, -5.459, 0.29)
db=false
button.MouseClick:Connect(function()
    if db==false then
        tweenModel(doorup, frameupopen)
        tweenModel(doorlow, framelowopen)   
    end
end)

Any way I can change the position without changing the orientation? Thanks.

0
Why don’t you change Position? OnaKat 444 — 4y
0
^ And why you change CFrame OnaKat 444 — 4y

Answer this question