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

"CFrame cannot be assigned to" error, don't know what it means?

Asked by 8 years ago

I'm trying to CFrame:lerp a model I've done, but I've had to do it for individual parts (4 in total), but I keep getting the error,

01:04:18.464 - CFrame cannot be assigned to
01:04:18.466 - Script 'Workspace.Model.Script', Line 17
01:04:18.468 - Stack End

from the code

local doorA = script.Parent.Door.DoorA.CFrame
local doorB = script.Parent.Door.DoorB.CFrame
local windowA = script.Parent.Door.WindowA.CFrame
local windowB = script.Parent.Door.WindowB.CFrame
local doorAClosed = CFrame.new(script.Parent.DoorAClosed.Position)
local doorBClosed = CFrame.new(script.Parent.DoorBClosed.Position)
local doorAOpen = CFrame.new(script.Parent.DoorAOpen.Position)
local doorBOpen = CFrame.new(script.Parent.DoorBOpen.Position)
local windowAClosed = CFrame.new(script.Parent.WindowAClosed.Position)
local windowBClosed = CFrame.new(script.Parent.WindowBClosed.Position)
local windowAOpen = CFrame.new(script.Parent.WindowAOpen.Position)
local windowBOpen = CFrame.new(script.Parent.WindowBOpen.Position)

script.Parent.Sensor.Touched:connect(function()
    for i = 0, 1, 0.1 do 
        doorA.CFrame = doorA:lerp(doorAOpen,i);
        doorB.CFrame = doorB:lerp(doorBOpen,i);
        windowA.CFrame = windowA:lerp(windowAOpen,i);
        windowB.CFrame = windowB:lerp(windowBOpen,i);
    wait();
    end
    wait(5)
    for i = 0, 1, 0.1 do 
            doorA.CFrame = doorA:lerp(doorAClosed,i);
        doorB.CFrame = doorB:lerp(doorBClosed,i);
        windowA.CFrame = windowA:lerp(windowAClosed,i);
        windowB.CFrame = windowB:lerp(windowBClosed,i);
    wait();
    end
end)
1
doorB is a cframe value not a part. You will prob need a 3rd variable. Eg. startCF, finishCF, and the part being lerped. EgoMoose 802 — 8y

Answer this question