title: A lua script on roblox that moves a model upwards?
body: <p>I have a model called door
  Inside I have a BoolValue named Open
  I have a model called Top that has all of the door blocks named Work Mabey Comeon and Proboblynot
  And I have Block that when touched is supposed to make Top move up</p>
  
  <p>Directly inside door I have this script</p>
  
  <pre><code>door = script.Parent
  open = door.Open
  Top = door.Top
  
  opener = 18
  speed = 100
  steps = speed
  
  startl = Top.CFrame
  
  function MoveDoorToCFrame(cfrm,dr)
      dr.Work.CFrame = cfrm
  dr.Mabey.CFrame = dr.Work.CFrame * CFrame.new(0,-7.2,0)
  dr.Comeon.CFrame = dr.Work.CFrame * CFrame.new(0,10.8,0)
  dr.Problynot.CFrame = dr.Work.CFrame * CFrame.new(0,10.8,0)
  end
  
  function Update()
  if speed/steps &lt; 0.5 then
      calc = 1-math.cos(math.rad((-90/speed)*steps*2))
  else
      calc = 1+math.sin(math.rad((90/speed)*((speed/2)-steps)*2))
  end
  MoveDoorToCFrame(startl * CFrame.new(0,(calc/2)*opener,0),Top)
  end
  
  Update()
  while true do
  wait()
  if not open.Value and steps &lt; speed then
      steps = steps + 1
      Update()
  elseif open.Value and steps &gt; 0 then
      steps = steps - 1
      Update()
  end
  end 
  </code></pre>
  
  <p>Inside the button that is supposed to activate on touch I have</p>
  
  <pre><code>script.Parent.Touched:connect(function()
  script.Parent.Parent.Open.Value = not script.Parent.Parent.Open.Value
  end)
  
  script.Parent.Parent.Open.Changed:connect(Update)
  Update()
  </code></pre>
  
  <p>If you know how to fix this it would be gladly appreciated.</p>