So, every time I click the curtain, it keeps rotation (I don't know much about rotations). my code:
local s = script.Parent local switch = true s.ClickDetector.MouseClick:connect(function() if switch == true then switch = false s.Rotation = Vector3.new(0, 90, 0) s.Size = Vector3.new(15.216, 8.503, 0.2) s.CFrame = CFrame.new(10.1, 8.25, -54.408) elseif switch == false then switch = true s.Rotation = Vector3.new(0, 90, 0) s.Size = Vector3.new(2.416, 8.503, 0.2) s.CFrame = CFrame.new(10.1, 8.25, -54.408) end end)
Thanks for the help :)
If you want it to keep its rotation, you can subtract the position from the old CFrame, then add it back on, like this:
local s = script.Parent local switch = true s.ClickDetector.MouseClick:connect(function() if switch == true then switch = false s.Rotation = Vector3.new(0, 90, 0) s.Size = Vector3.new(15.216, 8.503, 0.2) local oldRotation = s.CFrame - s.Position s.CFrame = CFrame.new(10.1, 8.25, -54.408) * oldRotation elseif switch == false then switch = true s.Rotation = Vector3.new(0, 90, 0) s.Size = Vector3.new(2.416, 8.503, 0.2) local oldRotation = s.CFrame - s.Position s.CFrame = CFrame.new(10.1, 8.25, -54.408) * oldRotation end end)