I've got a script, yes it works perfectly, but it's blocky. I'm trying to make it smoother, as if it was properly animated.
function click()
if(script.Parent.Status.Value)=="Closed" then
script.Parent.Status.Value="Opening"
local movements=40
local speed=0.1
for i=1,movements do
wait(0.01)
script.Parent.PLT:SetPrimaryPartCFrame(script.Parent.PLT.PrimaryPart.CFrame + Vector3.new(0,0,speed));
end
local sidemoves=250
local sidespeed=0.1
for i=1,sidemoves do
wait(0.01)
script.Parent.PLT:SetPrimaryPartCFrame(script.Parent.PLT.PrimaryPart.CFrame + Vector3.new(sidespeed,0,0));
end
script.Parent.Status.Value="Open"
--negative movement
elseif(script.Parent.Status.Value)=="Open" then
script.Parent.Status.Value="Closing"
local sidemoves=250
local sidespeed=0.1
for i=1,sidemoves do
wait(0.01)
script.Parent.PLT:SetPrimaryPartCFrame(script.Parent.PLT.PrimaryPart.CFrame + Vector3.new(-sidespeed,0,0));
end
local movements=40
local speed=0.1
for i=1,movements do
wait(0.01)
script.Parent.PLT:SetPrimaryPartCFrame(script.Parent.PLT.PrimaryPart.CFrame + Vector3.new(0,0,-speed));
end
script.Parent.Status.Value="Closed"
end
end
script.Parent.Control1.SurfaceGui.TextButton.MouseButton1Click:connect(click)

2 comments
You should try CFrame:lerp() http://wiki.roblox.com/index.php?title=CFrame#Methods
I don't understand how to use CFrame:lerp()