I've done a script what is working but when I want to close the doors it will start bug. Its opening and closing both and I dont know how to handle with that. :/

if d == false then
		d=true
		for i = 0,1,.00001 do
			local cfm = workspace.SurfaceBlastDoor.PrimaryPart.CFrame:Lerp(finish,i)
			workspace.SurfaceBlastDoor:SetPrimaryPartCFrame(cfm)
			wait()
		end
	else
		d=false
		for i = 0,1,.00001 do
			local cfm = workspace.SurfaceBlastDoor.PrimaryPart.CFrame:Lerp(starpos,i)
			workspace.SurfaceBlastDoor:SetPrimaryPartCFrame(cfm)
			wait()
		end
end

1 comment

0

Please explain a bit more. do you mean it opens and closes the door at the same time?